|
The phrase "something awful" is not exclusively licensed by these forums or anything
|
# ¿ Apr 23, 2015 01:16 |
|
|
# ¿ May 10, 2024 18:04 |
|
Gothmog1065 posted:Thanks. I really need to get into writing quick for loops like that. comprehensions, not for loops
|
# ¿ Oct 8, 2015 20:02 |
|
Roargasm posted:Recursively you could do: Pro tip: don't name variables str (or list or int, etc.)
|
# ¿ Oct 15, 2015 15:53 |
|
vodkat posted:Whats the neatest way to sort a list of integers into other lists? At the moment I've got something and its working fine, but I'm sure its probably a really inefficient way to solve this problem. My python is super rusty so this may not be very pythonic or even that efficient but code:
e: forgot to append the leftovers, fixed No Safe Word fucked around with this message at 16:23 on Oct 15, 2015 |
# ¿ Oct 15, 2015 16:19 |
|
Python comes with a csv module which will simplify some of that Your more general questions is that pinging by computer name will only work if you get name resolution via NetBIOS/WINS, which if you're in a domain should "just" work (or really I think even if you're just on the same subnet, I think Windows runs network discovery services for those kind of name announcements, though I can't remember for sure). The name resolution stuff is more of a network sys admin question. Hopefully they're aware of what you're doing if you're going to be randomly pinging machines on the network
|
# ¿ Feb 18, 2016 23:12 |
|
Python using the Go runtime? Why not: https://opensource.googleblog.com/2017/01/grumpy-go-running-python.html
|
# ¿ Jan 4, 2017 18:08 |
|
Hammerite posted:The use of _ to mean "this is an unused variable" is bad. Don't tell people to do that. If you need a variable that's unused, use the word "unused". Good lord no, _ as "ignore me" is convention. Naming a variable "unused" is worse than just naming it the intentionally-awkward-and-already-established-as-conventional name.
|
# ¿ Feb 1, 2017 18:02 |
|
Hammerite posted:It's a bad convention. It's unnecessarily cryptic, and fails to be self-explanatory. On the other hand if you name a variable "unused", that's self-explanatory. code:
|
# ¿ Feb 1, 2017 20:26 |
|
Dominoes posted:This is the way to handle it: You whippersnappers with your expanded tuple unpacking. *waves python 1.5.2 stick*
|
# ¿ Feb 2, 2017 02:06 |
|
Hammerite posted:I've dragged this argument (in which I am clearly in the minority) out for too many posts already, but... I don't see that it does make it harder to read for anybody, irrespective of their level of experience. If I see an underscore I know without any thought "oh, that's stuff that's not used". If I see anything else, I have to parse it. I also have to wonder "hmm, is it really unused? if this were just an underscore it would stand out elsewhere if somebody tried to use it, but somebody got cute and tried to use a name with semantic meaning for a throwaway variable" So yeah, something you can immediately and without any conscious thought ignore is simpler
|
# ¿ Feb 2, 2017 17:18 |
|
|
# ¿ May 10, 2024 18:04 |
|
lifg posted:I do like this convention, but I don't see it much. Haskell O'Caml F# They all have the convention of "anytime we need a placeholder for bindings we will discard, use an underscore"
|
# ¿ Feb 2, 2017 18:11 |