|
Something like this?code:
|
# ¿ Dec 16, 2009 07:23 |
|
|
# ¿ May 19, 2024 21:06 |
|
Well how about this then:code:
|
# ¿ Dec 16, 2009 07:44 |
|
BattleMaster posted:I'm having a problem getting a script to work. I've traced the problem back to getopt returning two empty lists no matter what arguments are supplied to the script. Here's how it is being used: Are you sure sys.argv[1:] has data in it? It seems likely to have data so that might be something easily overlooked. That same script works perfect for me on OS X.
|
# ¿ Feb 13, 2010 22:29 |
|
deichkind42 posted:Ok, does anyone know how to properly write windows filenames in python 2.7? I recently saw a suggestion on solving this problem from here (it has a long write up on this problem). You do code:
|
# ¿ Jul 29, 2010 08:31 |
|
code:
leterip fucked around with this message at 16:17 on Jul 29, 2010 |
# ¿ Jul 29, 2010 16:10 |
|
tef posted:
Very nice. This is a version that generalizes to any n: code:
|
# ¿ Jul 29, 2010 18:39 |
|
Why not just use append? >>> usernames = [] >>> usernames.append("praxxis") >>> usernames ['praxxis'] >>>
|
# ¿ Dec 9, 2010 08:13 |
|
You could also write a simple generator.code:
|
# ¿ Jan 3, 2011 20:06 |
|
Suspicious Dish posted:Except that's not what the for...else loop does. It's what it should do, though. code:
|
# ¿ Dec 12, 2011 17:00 |
|
Rocko Bonaparte posted:I'm looking for some general advice on getting a Python REPL working in a GUI. I am doing some stuff with 3d, and kind of want a Python console to plop down when I hit tilde, like one would expect a console generally to be for stuff like that. Is there any existing stuff to do that in Python? I was hoping for some helpers for things like history and getting all the tab indent prompts correct. I had been through doing this somewhat manually in C# before, and found it to be really tedious. So I want to avoid having to start from scratch. I did a little bit of Googling and if you can throw twisted in there you can use twisted.conch.stdio. Either python -m twisted.conch.stdio or just from twisted.conch import stdio; stdio.main() and you get a nice REPL (it even had syntax coloring for me!)
|
# ¿ Jan 30, 2012 17:01 |
|
MeramJert posted:Hold on, how does 169.254.13.24 get converted to the 14th and 25th words? I don't understand Well, 0 is the 1st word, so 13 is the 14th word, and you get the picture.
|
# ¿ Feb 10, 2012 17:14 |
|
Lister_of_smeg posted:Just come across this little snippet of code. code:
|
# ¿ Mar 1, 2012 15:43 |
|
Your solution doesn't merge them in linear time. The sorted call runs in O(n logn) time.
|
# ¿ May 22, 2012 18:30 |
|
tef posted:Despite this, people will tell you its performance without profiling it. Don't listen to these people, they are bad people. (also they do not know how python's sort works) Oh right, I forgot Timsort is amazing and uses ranges of already sorted data to run quicker. Thanks for pointing that out.
|
# ¿ May 22, 2012 21:51 |
|
Munkeymon posted:What am I missing? If your input has no elements, i is never created. Python code:
|
# ¿ Jun 8, 2012 20:26 |
|
Suspicious Dish posted:That would make bar(None) behave wrong. I'm not sure what Bodhi wants, though. How so? Seems like bar(None) would behave just like foo(None) would.
|
# ¿ Aug 12, 2012 22:08 |
|
PiotrLegnica posted:bar uses None as default argument, which is supposed to correspond to calling foo with a defaulted argument. But foo doesn't use None for that, so now semantics have changed.
|
# ¿ Aug 12, 2012 22:56 |
|
PiotrLegnica posted:That code is a response to this: Yeah but that code was a completely different definition. I guess I just got confused because I thought the code he quoted didn't have the problem he was describing.
|
# ¿ Aug 12, 2012 23:25 |
|
tef posted:javascript/json only has double precision floating point That's just javascript. json as a spec allows arbitrary sized integers/decimals.
|
# ¿ Aug 14, 2012 21:55 |
|
|
# ¿ May 19, 2024 21:06 |
|
yaoi prophet posted:What's the idiomatic way for initializing a bunch of variables to the same value without that kind of sharing? I might do something like Python code:
|
# ¿ Mar 14, 2013 20:00 |