|
OnceIWasAnOstrich posted:Alternatively if you want to build the package as normal use pip anyway.
|
# ? Apr 25, 2014 19:07 |
|
|
# ? Jun 12, 2024 04:12 |
So once I get my conda environment setup locally, how do you get the configuration in version control and then deploy out to production machines?
|
|
# ? Apr 25, 2014 19:15 |
|
Brennan posted:I just worked through Learning Python by Lutz and feel like I have a decent beginners level grasp of the language. I'm learning because I'm in a computer forensics program, and it's a good skill to have in the field but the program doesn't really touch on it. Are there any recommendations of newbie friendly places where I might be able to contribute and it would let me practice and learn through doing? I'm willing to put in the time, I'm just hoping for some direction. I don't know much about computer foresincs but I have an interest in it. If material can help you, I really like this basic intro to NLP by Peter Norvig: http://nbviewer.ipython.org/url/norvig.com/ipython/How%20to%20Do%20Things%20with%20Words.ipynb edit: duh I was thinking of foresinc linguistics Symbolic Butt fucked around with this message at 21:43 on Apr 25, 2014 |
# ? Apr 25, 2014 19:17 |
|
fletcher posted:So once I get my conda environment setup locally, how do you get the configuration in version control and then deploy out to production machines? conda list -e will spit out an environments contents in a way that conda install --file <file> can use to recreate. code:
|
# ? Apr 25, 2014 19:31 |
Looks pretty cool! I'm gonna play around with this today. Thanks for the examples! edit: Oh also, is my IDE (PyCharm) gonna freak out if I'm not using virtualenv anymore?
|
|
# ? Apr 25, 2014 19:41 |
|
fletcher posted:Looks pretty cool! I'm gonna play around with this today. Thanks for the examples! No, you just point it to the right interpreter.
|
# ? Apr 25, 2014 19:47 |
|
BigRedDot posted:Yah that was an early decision, we wanted simple named environments but also didn't want to have to introduce a persistence layer to map those names to absolute paths. conda started out as just a devops tool for us, if I'd known how popular it would become I probably would have made a different decision. Still I can imagine it would not be to difficult to add this kind of behavior: source activate -r <relpath> or something similar. I'll mention this to Aaorn and Ilan but the best way is to make a GH issue (https://github.com/conda/conda) or ask about it on the mailing list. (Edit: or even better a Pull Request!) I did ask on github a while ago but I don't think it's high on anyone's priority list (it's not high on mine either, since I've got my own scripts around conda at this point). It is nice that source activate ./myenv works though. I remember trying this back when I started using conda and back then it would just add ./myenv to my path which obviously doesn't work if you change to a different working directory. This seems to be fixed though.
|
# ? Apr 25, 2014 20:30 |
|
I was learning Python earlier through the Google classes but I had to drop it since stuff came up. During those courses it told you to indent 2 spaces but this CodeAcademy site that I got recommended is telling me to do 4. What is the most accepted way to indent? Both are functional, two seems functional enough to catch my eye for debugging purposes.
|
# ? Apr 27, 2014 19:03 |
|
That's weird, the Google style guide says 4 spaces: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Indentation
|
# ? Apr 27, 2014 19:07 |
|
YouTuber posted:I was learning Python earlier through the Google classes but I had to drop it since stuff came up. During those courses it told you to indent 2 spaces but this CodeAcademy site that I got recommended is telling me to do 4. What is the most accepted way to indent? Both are functional, two seems functional enough to catch my eye for debugging purposes. PEP8 is the canonical Python style guide, and it specifies 4 spaces. Most Python code you'll find has 4-space indents.
|
# ? Apr 27, 2014 19:10 |
|
SurgicalOntologist posted:That's weird, the Google style guide says 4 spaces: https://www.youtube.com/watch?v=tKTZoB2Vjuk Their supplementary video uses two and he states the google standard is two as well. I'll just use 4 if that is what the majority of people use.
|
# ? Apr 27, 2014 19:17 |
|
YouTuber posted:Their supplementary video uses two and he states the google standard is two as well. I'll just use 4 if that is what the majority of people use.
|
# ? Apr 27, 2014 19:21 |
|
I deviate from PEP8 on that, though if I'm sharing code with the wider world I just convert to 4 spaces. Personally, I like tabs for indentation and spaces for lining stuff up. That way people can set tabs to whatever width they want and things I want to stay aligned do so because I used spaces. The important thing to do, especially for beginners, is to stay consistent and a good way to stay consistent is to have a formal written guide, and PEP8 is great for that.
|
# ? Apr 27, 2014 20:13 |
|
I like the look of 4 spaces, 2 spaces barely looks different from 1
|
# ? Apr 28, 2014 02:47 |
|
pycharm's emacs emulation is really thorough, is there a way to get the emacs cua-mode? I can't seem to find an IDE that doesn't implement column select mode without some sort of poo poo mouse selection instead of the totally great ctrl+enter thing that cua-mode does.
|
# ? Apr 29, 2014 06:22 |
|
Python code:
|
# ? Apr 29, 2014 19:29 |
|
You never assigned anything to CharStr1.
|
# ? Apr 29, 2014 19:31 |
|
Suspicious Dish posted:You never assigned anything to CharStr1. I assigned input right? also, forgive me for this little thing lol
|
# ? Apr 29, 2014 19:53 |
|
You never call CharAttr, and even if you did CharStr1 is only declared inside its scope (as are many other things) so once execution leaves the function all those definitions go kaput. e: also recursing functions is generally a poor idea in Python - in this example I can fill your call stack by repeatedly providing invalid input.
|
# ? Apr 29, 2014 19:58 |
|
Suspicious Dish posted:You never assigned anything to CharStr1. To add a little bit to this, your indenting and/or logic appears to be off. You have a function called CharAttr() but that functions ends after the last indented elif statement. Python code:
You have three options:
Lyon fucked around with this message at 20:02 on Apr 29, 2014 |
# ? Apr 29, 2014 19:58 |
|
Lyon posted:To add a little bit to this, your indenting and/or logic appears to be off. You have a function called CharAttr() but that functions ends after the last indented elif statement. so I included everything in one function and called it at the end of the file Python code:
instead of giving a numerical value for one of the character's attributes, I typed a word in to test the validation.
|
# ? Apr 29, 2014 20:18 |
|
QuarkJets posted:I like the look of 4 spaces, 2 spaces barely looks different from 1 Set your tab size to a single space, then use four tabs.
|
# ? Apr 29, 2014 20:18 |
|
Well don't do that! Your validation assumes that the end user is passing in a number and only checks to make sure it falls within a specific range. You're not doing any form of type validation. Also... using option number one is probably the fastest way to get your program running but option number two was really the correct solution. You'll want to learn about returning values from your functions (and passing arguments into functions too).
|
# ? Apr 29, 2014 20:22 |
|
lufty posted:but now I get another traceback error when my program tries to validate a user's input. And what did you expect to happen? It seems reasonable to get an error here.
|
# ? Apr 29, 2014 20:22 |
|
You want to get a number from the user and convert it into a Python integer using int(), but you want the program to be able to react if the user doesn't supply something that can be recognised as a number. Try running this code and see if you can use something similar in your function. code:
|
# ? Apr 29, 2014 20:42 |
|
I'm new to python and building a web scraper using HTMLParser. I'm using this altered code sample almost exactly from the HTMLParser page:code:
quote:Date found! December 19
|
# ? Apr 29, 2014 20:42 |
|
Hammerite posted:You want to get a number from the user and convert it into a Python integer using int(), but you want the program to be able to react if the user doesn't supply something that can be recognised as a number. "except" is invalid syntax apparently
|
# ? Apr 29, 2014 21:42 |
|
Literally Elvis posted:I'm new to python and building a web scraper using HTMLParser. I'm using this altered code sample almost exactly from the HTMLParser page: You should post your complete code and data, that code doesn't produce that output by itself. But best guess is that "if data in ndchars" doesn't work how you think it does, and would let '\n', ' \n', '\n ', '\r\n' and some other stuff through.
|
# ? Apr 29, 2014 21:54 |
|
Lufty: One tiny thing, just cause I think I remember you doing it in an earlier post too. You really don't need to include an explanatory comment when you're importing something ubiquitous from the standard library with an unmistakable name like "random".
|
# ? Apr 29, 2014 22:12 |
|
supercrooky posted:You should post your complete code and data, that code doesn't produce that output by itself. But best guess is that "if data in ndchars" doesn't work how you think it does, and would let '\n', ' \n', '\n ', '\r\n' and some other stuff through. Actually, just adding '\n' worked fine. I am a doofus. vv
|
# ? Apr 29, 2014 22:24 |
|
lufty posted:"except" is invalid syntax apparently Are you quite sure you didn't make any errors entering/copy-pasting the code from my post? There shouldn't be any issue with the "except" keyword. Try copy-pasting the code into a text file and running the file as a script.
|
# ? Apr 29, 2014 23:08 |
|
welp, at least there's a workaround, but am I doing something fantastically stupid here? I mean, even stupider than my normal level. To be clear, you're seeing sorted fail to finish sorting when I hand it the output of Series.clip.
|
# ? Apr 30, 2014 16:27 |
|
Isn't there a sorted method of Series? If so it's probably more reliable. In any case you should report this on the pandas github.
|
# ? Apr 30, 2014 18:30 |
|
lufty posted:but now I get another traceback error when my program tries to validate a user's input. Basically you did this: code:
And 'except' is definitely valid syntax. Can you provide the code block that you're testing and the error? The example that Hammerite provided is almost identical to the example that the Python docs use to introduce exception handling: https://docs.python.org/2/tutorial/errors.html#handling-exceptions
|
# ? Apr 30, 2014 19:26 |
|
QuarkJets posted:Basically you did this: He could have got that error message if he didn't type both closing brackets on the previous line.
|
# ? Apr 30, 2014 19:28 |
|
I'm programming a self-avoiding random walk. My question is: How would I get it so I could watch it walk in real-time? All I can do right now is just look at the completed Pylab plot after it's done.
|
# ? May 2, 2014 01:54 |
|
turtle is perfect for simple line drawings.
|
# ? May 2, 2014 02:07 |
|
more like dICK posted:turtle is perfect for simple line drawings. Interesting. I basically want to real-time plot about 10000 x,y coords.
|
# ? May 2, 2014 02:25 |
|
Well you could make a loop with time.sleep in-between every plot of a new point. Matplotlib can do animation more directly but that's a simple option you could try.
|
# ? May 2, 2014 02:42 |
|
|
# ? Jun 12, 2024 04:12 |
|
SurgicalOntologist posted:Isn't there a sorted method of Series? If so it's probably more reliable. In any case you should report this on the pandas github. The only one I can find is for an Index, but I only started using Pandas on Tuesday, so my knowledge and understanding of its capabilities is very much lacking
|
# ? May 2, 2014 16:26 |