|
I don't, but I'm pretty sure you're correct here. bash_profile is for login shells, bashrc is for interactive, non-login shells, so I don't think there would be any issues. Most similar tools put their code in bashrc, not bash_profile. It could be that the author is on OSX, where the Terminal app opens a new login shell for every window. But that's not the case on Linux which is why you encountered an issue. http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
|
# ? Oct 7, 2014 04:36 |
|
|
# ? May 9, 2024 03:33 |
|
I'm back with another question! My Code: code:
Sample a_1.0_b.dat code:
Read the second column of the file "a_1.0_b.dat" into an array, excluding the first row. Plot a normalized histogram of those values. IE: the total area of the histogram = 1 What it does: code:
|
# ? Oct 7, 2014 17:56 |
|
lotor9530 posted:I'm back with another question! You are missing a parenthesis on the previous line.
|
# ? Oct 7, 2014 18:06 |
|
accipter posted:You are missing a parenthesis on the previous line. Damnit. I feel like an idiot now. Thanks for the quick reply! One of these days I'll stop sucking at python.
|
# ? Oct 7, 2014 18:39 |
|
lotor9530 posted:Damnit. I feel like an idiot now. Dude, use pycharm. It will catch these mistakes for you.
|
# ? Oct 7, 2014 19:22 |
|
lotor9530 posted:Damnit. I feel like an idiot now. One way to deal with SyntaxErrors is to take a break for a little while and then come back.
|
# ? Oct 7, 2014 19:36 |
|
I just finished the Codecademy course on Python but I have the feeling that what I've learned won't be any good for practical applications. Any recommendations on other, more advanced courses (but not too much - this is my first attempt at learning programming), which I can take up as a follow up?
|
# ? Oct 7, 2014 20:56 |
|
Rlazgoth posted:I just finished the Codecademy course on Python but I have the feeling that what I've learned won't be any good for practical applications. Any recommendations on other, more advanced courses (but not too much - this is my first attempt at learning programming), which I can take up as a follow up? My brother fiddled around with the code acaedmy python course. I told him to move on to Think Python.
|
# ? Oct 7, 2014 21:33 |
|
SurgicalOntologist posted:I don't, but I'm pretty sure you're correct here. bash_profile is for login shells, bashrc is for interactive, non-login shells, so I don't think there would be any issues. Most similar tools put their code in bashrc, not bash_profile. Actually I would not put it in .bashrc if it has a chance of outputting content. I'd do what RVM does and actually output a recommendation to put it on either .bashrc or .bash_profile. You can see the ouput here: http://rvm.io/support/faq under "What shell login means ('bash -l')".
|
# ? Oct 7, 2014 21:58 |
|
Is there a relatively trivial way to load a webpage, watch for GET requests triggered by JS, and pull the cookies out of those? I can't get Webdriver to play nice with it.
|
# ? Oct 7, 2014 22:18 |
deimos posted:Actually I would not put it in .bashrc if it has a chance of outputting content. I'd do what RVM does and actually output a recommendation to put it on either .bashrc or .bash_profile. You can see the ouput here: http://rvm.io/support/faq under "What shell login means ('bash -l')". quote:RVM by default adds itself currently to ~/.bash_profile file, and the recommended way is to enable login shell in gnome-terminal (and screen). Is that this thing? What is actually changing when this setting changes?
|
|
# ? Oct 7, 2014 22:18 |
|
For someone coming from another language (C++ specifically), what are some recommendations for learning Python?
|
# ? Oct 8, 2014 15:07 |
|
As was posted just above: http://www.greenteapress.com/thinkpython/
|
# ? Oct 8, 2014 17:56 |
|
hooah posted:For someone coming from another language (C++ specifically), what are some recommendations for learning Python? Unless someone else has something specific to say about coming from C++, you're probably just best off with the Think Python thing. It will be a breeze to go through for someone with programming experience and will get you up to speed on Python syntax and other specifics.
|
# ? Oct 8, 2014 18:12 |
|
I'd also add that Python's official documentation is excellent, and good for getting oriented by. Beyond that, it depends on what you want to do. In my estimation, Python's strong points are web programming, scientific scripting, systems administration, general scripting, and rapid prototyping.
|
# ? Oct 8, 2014 18:27 |
|
Haystack posted:I'd also add that Python's official documentation is excellent, and good for getting oriented by. Just chiming in to say that's how I learned: I read through the docs and fiddled with examples in a REPL. I already knew several other not-super-dissimilar languages (JS, PHP) at the time, though.
|
# ? Oct 8, 2014 19:04 |
|
While we're at it, I'm learning Python for my first language based on the recommendation of it being easy to learn for beginners. With that said, I have specific needs which I am not sure I will be able to meet with Python alone. Specifically, I'm learning programming in order to do stuff such as handling large data sets in CSV and XLS files among other formats (I want to automate some of the more repetitive tasks such as merging files and such); running statistical analysis; and retrieve specific types of information from the Internet while saving it in a workable format(something like, retrieving all search results in Google Scholar for publications in a given country, and sort them neatly into an Excel file). Will I be able to (eventually) do all this in Python, or would I be better off moving on to another language once I'm done learning this?
|
# ? Oct 8, 2014 19:42 |
|
Rlazgoth posted:While we're at it, I'm learning Python for my first language based on the recommendation of it being easy to learn for beginners. With that said, I have specific needs which I am not sure I will be able to meet with Python alone. This is all stuff that be done in Python without too much trouble.
|
# ? Oct 8, 2014 19:44 |
|
Rlazgoth posted:While we're at it, I'm learning Python for my first language based on the recommendation of it being easy to learn for beginners. With that said, I have specific needs which I am not sure I will be able to meet with Python alone. Those are all pretty much exactly in python's sweet spot. There are libraries for dealing with everything you listed.
|
# ? Oct 8, 2014 20:48 |
|
Oh! Also check out Open Refine (formerly Google Refine). It's a tool for working with and extending data using data from other sources. It also stores all of the transformations you do in the project, so if you want to repeat a set of transformations, you can just pop in another huge dataset and tell it to run the same changes again.
|
# ? Oct 8, 2014 20:53 |
|
Alright, thanks for the recommendation. I'd prefer not to faff about with Linux if I don't have to, since I use Windows 90%+ of the time, so with that in mind, what's the best IDE for Python? I saw Python Tools for Visual Studio, which appeals to me since I'm fairly competent with VS anyway. Is that any good?
|
# ? Oct 8, 2014 20:53 |
|
hooah posted:Alright, thanks for the recommendation. I'd prefer not to faff about with Linux if I don't have to, since I use Windows 90%+ of the time, so with that in mind, what's the best IDE for Python? I saw Python Tools for Visual Studio, which appeals to me since I'm fairly competent with VS anyway. Is that any good? PyCharm.
|
# ? Oct 8, 2014 20:53 |
|
EAT THE EGGS RICOLA posted:PyCharm. ...is always the right answer.
|
# ? Oct 8, 2014 21:10 |
|
I've used Python as my main professional tool for the last 6 or so years, and now I'm sort of handholding my friend who's a learning programming as a hobby. I recommended him to start with python, and in particular http://learnpythonthehardway.org/ by Zed Shaw. I'd be interested to hear what you guys think of it, as a beginner's resource? I haven't read this one myself, but recommended it nonetheless based on the fact that I really liked "Learn C the hard way" by the same author, because of his down-to-business style. I like that Zed wastes no time talking about stuff, but instead gets right down to doing them, and then when you've done them you can reason about them more efficiently because at that point you already know how they work, so it's less abstract. I also think the C one is well organized, so you're learning stuff pretty darn quickly, and despite this it feels like it's small and simple steps forward all the time. In particular, I'd be interested to hear a comparison to this book: Lumpy posted:As was posted just above: http://www.greenteapress.com/thinkpython/ I read 3 words of that and became angry. These words were "from TurtleWorld import *", in "Chapter 4 Case study: interface design". Reading on just a tad, they go on to explain iteration, by showing how to repeatedly use the funtions fd() and lt() from their TurtleWorld package. So chapter 4 on interface design covers iteration instead of how to choose good names for your interface, and the first example they present is complete garbage. I don't know one experienced python programmer who'd put fd() and lt() in an api that they'd show to others, instead of move_forward() and turn_left(). Rather, I believe they would be slapped about the ears if they did. And please don't teach people to import *. Protip: import only what you're going to use, so you'll know what you're actually using, and from where you got it. Otherwise there will be misery, tears and ruin waiting for you down the line, when fd() suddenly is no longer "move forward" but "format drive" that you had no idea was going to be introduced in the next update to the package that your program imports * on the next line down. So is the rest of this book equally garbage, or does it have redeeming qualities? (And is my recommendation in fact equally offensive? ) e: I cannot spell TurdleWorld. Karate Bastard fucked around with this message at 21:18 on Oct 8, 2014 |
# ? Oct 8, 2014 21:14 |
|
EAT THE EGGS RICOLA posted:PyCharm. This should probably just get added to the OP at this point.
|
# ? Oct 8, 2014 22:32 |
|
Karate Bastard posted:I read 3 words of that and became angry. I'm pretty sure the author was keen on reproducing the original turtle graphics logo experience, where the commands were stuff like LT and PU. I never read much of those case studies chapters (because at the time I read the book they weren't there) but even if the author could update the chapter using the stdlib turtle I think it's a good experience to make the reader mess around with third party libraries at this point. I think you have a point about import *, even if the author states the disadvantage in the previous chapter I feel like it's not a thing that should be encouraged in any way. Anyway... I don't like Zed Shaw, he's kind of a douche and his personality comes off in his book. I don't think it's a bad book really but it mildly irritates me how he teaches about programming as if he was a drill instructor. Some people are ok with that, it's a personality clash I guess. The Codecademy python course is great for people who never programmed before, but I'm pretty sure everyone comes out of it with the impression that it's kind of shallow. Because it really is shallow, and it's not their fault really. It's made for absolute beginners feel great about programming. In my opinion Think Python comes as a great follow-up because, even still with a newbie-friendly approach, it actually teaches a lot of CS/programming culture. I love the glossaries, I love how he defines a shitton of programming lexicon like data structure, accumulator, attribute etc. I keep referring back to these definitions even today. I don't think Hard Way is shallow, but it's definitely not as deep as Think Python. There are aspects about it where it's better and contemporary, like the chapters about testing. Think Python's approach seems to be more academic and it misses practical stuff like that. But then I think a better follow-up to Think Python is something like Peter Norvig's course where he deals with these things and also a lot of other unintuitive python features.
|
# ? Oct 8, 2014 22:58 |
|
Haha yes I can see how you could get annoyed by that tone, but I actually appreciate it. I don't have much time to spend on this stuff so I like the terseness, and when I feel compelled to cut/paste his examples and not learn a goddamn thing, he tells me not to, and I go well, ok then you cheeky bastard, and type it out like he says I should, and actually pay attention to what I do, actually learning the stuff faster. In what way is he a douche? I have no idea who he is. I think I just found him on Google. Or some goon may have recommended the C book to me. e: vvvvvv he's got all these "learn X the hard way" books, where "the hard way" is just typing everything out yourself, doing every exercise yourself, in order, from beginning to end. You're not supposed to skip ahead or copy/paste, but to type every single thing out yourself. Idea is that then you'll actually notice that there's actually brackets here or there instead of colons or what have you, and that is significant for some reason, and then you can reflect on that and possibly learn someting that you hadn't if you had skipped ahead or copypasted. Works for me Karate Bastard fucked around with this message at 23:51 on Oct 8, 2014 |
# ? Oct 8, 2014 23:40 |
|
I don't understand why anybody would want to learn Python the hard way. C, sure, C is a minefield. Python is meant to be relatively friendly and forgiving for first-timers.
|
# ? Oct 8, 2014 23:41 |
|
Karate Bastard posted:In what way is he a douche? I have no idea who he is. I think I just found him on Google. Or some goon may have recommended the C book to me. He's not really a douche he's just unrepentantly opinionated and doesn't apologize for it (not that he needs to), so he comes off a bit brusque if you disagree with one if his opinions. But I don't think it's malicious in intent, it's just his way of expressing his opinion. I mean I just googled his name for an example of it and a top result was his essay titled "Programmers Need To Learn Statistics Or I Will Kill Them All"
|
# ? Oct 8, 2014 23:48 |
|
Karate Bastard posted:Think Python vs Hard Way They both have things you can pick out and complain about...just like any programmer can do with any large enough sample of anothers code. Overall they are both good and both have been go-to recommendations in this thread for years.
|
# ? Oct 9, 2014 00:02 |
|
hooah posted:Alright, thanks for the recommendation. I'd prefer not to faff about with Linux if I don't have to, since I use Windows 90%+ of the time, so with that in mind, what's the best IDE for Python? I saw Python Tools for Visual Studio, which appeals to me since I'm fairly competent with VS anyway. Is that any good? Honestly, PyCharm rules but just get this: https://store.continuum.io/cshop/anaconda/ Use IPython Notebook for all your data munching and stats needs.
|
# ? Oct 9, 2014 04:24 |
|
Blinkz0rz posted:Honestly, PyCharm rules but just get this: https://store.continuum.io/cshop/anaconda/ You say that like they're mutually exclusive. Pycharm+anaconda is a great combination. (but get miniconda and install the packages you need with conda/pip, anaconda is huge and includes a ton of stuff you will almost certainly never use).
|
# ? Oct 9, 2014 07:42 |
|
The Python thread might be the best place to ask: where do people usually get their datasets for Data Visualization projects, like on Ladyparts and Orienteer.it? I want to do my next project in dataviz, but I'm not sure where I'd get these open-source sets of data. I've done a good bit of Googling, but a lot of them are either heavily outdated, for pay, or don't actually have the statistics/data I need. Mining stuff from Twitter has proven to be a loving pain, too.
|
# ? Oct 9, 2014 14:16 |
|
Pollyanna posted:The Python thread might be the best place to ask: where do people usually get their datasets for Data Visualization projects, like on Ladyparts and Orienteer.it? I want to do my next project in dataviz, but I'm not sure where I'd get these open-source sets of data. I've done a good bit of Googling, but a lot of them are either heavily outdated, for pay, or don't actually have the statistics/data I need. Mining stuff from Twitter has proven to be a loving pain, too. Check out governmental open data portals (some are way better than others) or just search for "thing_you_want api" (lots of companies have api access to their data because it gets people to make cool stuff with their platform.) I've petitioned the city I live in to release lots of datasets and they've been good about it because it's pretty "safe" politically and everyone seems to love "open data".
|
# ? Oct 9, 2014 14:22 |
|
I feel pretty dumb. I installed PyCharm, and tried the "Hello, World!" program in the Think Python book (print('Hello, World!')). When I ran it in PyCharm, I see this in the output window:code:
|
# ? Oct 9, 2014 14:53 |
|
Pollyanna posted:The Python thread might be the best place to ask: where do people usually get their datasets for Data Visualization projects, like on Ladyparts and Orienteer.it? I want to do my next project in dataviz, but I'm not sure where I'd get these open-source sets of data. I've done a good bit of Googling, but a lot of them are either heavily outdated, for pay, or don't actually have the statistics/data I need. Mining stuff from Twitter has proven to be a loving pain, too. I found this with a little bit of googling, which might be helpful. If you provide more specifics of what sort of data you are looking for we might be able to provide specific recommendations.
|
# ? Oct 9, 2014 15:49 |
|
hooah posted:I feel pretty dumb. I installed PyCharm, and tried the "Hello, World!" program in the Think Python book (print('Hello, World!')). When I ran it in PyCharm, I see this in the output window: It's more likely to be something about your system/install, I would guess. Can you run a Python console from PyCharm (tools menu I think) or do you get an error right away?
|
# ? Oct 9, 2014 16:35 |
|
I'm trying to write a simple script in python that effectively just automates a bunch of linux CLI commands and executes some perl/ruby scripts. As far as I can tell, I can just use subprocess.call to issue commands and then pass any arguments, such as : code:
|
# ? Oct 9, 2014 19:00 |
|
psydude posted:I'm trying to write a simple script in python that effectively just automates a bunch of linux CLI commands and executes some perl/ruby scripts. Yes. Why don't you just try it and see?
|
# ? Oct 9, 2014 19:07 |
|
|
# ? May 9, 2024 03:33 |
|
SurgicalOntologist posted:It's more likely to be something about your system/install, I would guess. Can you run a Python console from PyCharm (tools menu I think) or do you get an error right away? Interestingly, it works on my laptop, but not on my desktop. However, I was able to use the command-line interpreter to correctly print the statement. What does this mean?
|
# ? Oct 9, 2014 19:34 |