Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Oct 7, 2017 09:08
is this a python thing or a cython implementation thing
Oct 7, 2017 09:08
in cython at least if you list slice way out of range you get an empty list. e.g. [1,2][100:1001] >> []
Oct 7, 2017 09:07
cbg
Sep 14, 2017 22:12
we can't afford this willy-nilly usage of bytes
Sep 14, 2017 22:12
thanks for the confirmation!
Sep 14, 2017 22:12
kevin'd
Sep 14, 2017 22:10
dict.fromkeys(keys, []) will use the same list and you get a bunch of problems, unfortunate. What is the "best" alternative?
Sep 14, 2017 22:10
what's the best way to make a dictionary of lists
Sep 14, 2017 19:02
change stderr too
Sep 14, 2017 19:01
this is kind of hilarious
Sep 14, 2017 19:01
AttribUteError: 'Upperizer' object has no attribUte 'flUsh'
Sep 14, 2017 18:50
pass argUment a
Sep 14, 2017 18:49
lol
Sep 14, 2017 18:49
oh wait no, it doesn't let you ovveride the word usage
Sep 14, 2017 18:48
12
Q: Custom 'usage' function in argparse?

devav2Is it possible to add a custom 'usage' function instead of default usage message provided by python argparse. Sample code: parser = argparse.ArgumentParser(description='Sample argparse py') parser.add_argument('-arg_1',type=int, custom_usage_funct('with_some_message')) output = parser.parse_arg...

Sep 14, 2017 18:48
argparse.ArgumentParser(usage=My_Help_Func)
Sep 14, 2017 18:46
argparse is great.
Sep 13, 2017 21:31
every day my choice to stick to python3 is reaffirmed, thanks wim
Sep 13, 2017 20:23
I realized that after I spoke >.<
Sep 13, 2017 18:53
less lines = less complexity, obviously
Sep 13, 2017 18:32
ahhhhh, okay. I figured it out, thanks all!
Sep 13, 2017 18:31
or is that possible
Sep 13, 2017 18:31
but I can't reference it with self like I would with an object
Sep 13, 2017 18:30
looks like I have some reading to do!
Sep 13, 2017 18:30
how is this legal:
>>> def foo():
... pass
...
>>> foo.a = 0
>>> print(foo.a)
0
Sep 13, 2017 18:27
you can print and then return from a function, if you want to do both
Sep 13, 2017 18:26
correct me if i'm wrong but python cleans up all local variables in a function once it exits and leaves the scope.
Sep 13, 2017 18:23
In response to that, coding some graph traversal algorithms would be incredibly more tedious if you could only have one return statement
Sep 13, 2017 17:36
working as intended
Sep 13, 2017 17:35
designed noop
 
Sep 13, 2017 17:15
I'm working on a response
Sep 13, 2017 17:07
You should also describe what your code does and explain some of your thinking. This was mentioend in the comments. It's important that you read the rules for posting.
Sep 13, 2017 17:00
People will start commenting saying you will do this
Sep 13, 2017 17:00
You should copy and paste the code into your post. Edit it to do this
Sep 13, 2017 16:59
then I will look at it
Sep 13, 2017 16:59
message me in this chat when you do a full post on code review
Sep 13, 2017 16:58
I understand that you're learning, and I want to help. But I have limitations in time as well. Do you want me to give comments now or a review later?
Sep 13, 2017 16:57
Well I don't like repeating myself either, I don't have all the freetime in the world to help you
Sep 13, 2017 16:56
otherwise I can give you some brief improvements right now
Sep 13, 2017 16:56
if you wait out the timer and then post all your code there I can give you a thorough explanation that will take maybe ~15-20 minutes to write out
Sep 13, 2017 16:56
yes
Sep 13, 2017 16:56
I wanted to point you that way because I could write a long formatted answer to your question
Sep 13, 2017 16:55
you have code and you want people to recommend improvements, this is something more for codreview
Sep 13, 2017 16:55
however'
Sep 13, 2017 16:55
every minute of every day there are repeate questions being asked, not often in the chatroom
Sep 13, 2017 16:55
many of the same questiosn get asked again, but the answer are already on stackoverflow and people get upset when someone can't find answers for themselves
Sep 13, 2017 16:54
how do you mean?
Sep 13, 2017 16:54
The people in that chatroom are the best python experts, and they don't have time to repeat the same answers over and over
Sep 13, 2017 16:54
A lot of the questions you have, other people have had too, and have asked them many times.
Sep 13, 2017 16:53
so the python chatroom is not really for discussing code improvement