|
Eela6 posted:This is syntatically equivalent to the following: Just a small correction, you actually meant this: Python code:
|
# ¿ Mar 28, 2017 21:12 |
|
|
# ¿ May 3, 2024 07:51 |
|
but you're actually using that variable! (this is the dumbest tangent)
|
# ¿ Apr 12, 2017 14:10 |
|
baka kaba posted:do I need to screw around parsing numbers from filenames here Most likely yes. If you make it explicit that the number part is an integer you'll get the sorting you want: >>> ('file', 2) < ('file', 10) True >>> ('file', '2') < ('file', '10') False
|
# ¿ Apr 24, 2017 19:12 |
|
Malcolm XML posted:
Malcolm XML is a smart guy but this post is dumb as gently caress. I mean, people start programming and with some experience assume that "float" is just a fancy name for numbers that intuitively behave like fixed-point numbers. This reasoning deflects the fact that real numbers are infinite. I don't think many introductory materials go into teaching the details of floating points, it's a somewhat low level thing. But it's too bad, because imo every introductory material should tackle a bit into the classic 0.1 + 0.2 = 0.30000000000000004 to clear out people's minds from intuitively assuming they're fixed-point.
|
# ¿ Jun 11, 2017 01:50 |
|
QuarkJets posted:Back when bitcoin was still newer a bunch of people learned first-hand that floating-point arithmetic has precision issues. oh man, I vaguely remember hearing about this fiasco, do you have a link?
|
# ¿ Jun 12, 2017 12:40 |
|
Philip Rivers posted:I've tried but a lot of it is over my head, I don't have much grounding in algorithms that I can readily parse the info out there. I'm pretty sure a basic line sweep algorithm would help you on this: https://courses.csail.mit.edu/6.006/spring11/lectures/lec24.pdf I'll try to find an online class with a video lecture on this later. If you're already on the level of drawing all these lines on the screen then implementing line sweep should not be tricky for you.
|
# ¿ Jun 20, 2017 20:16 |
|
Frank Viola posted:Hi guys, Are you using the MIMEText object from email.mime.text? Because the way you're sending msg, which is a concatenation of 2 strings, instead of a MIMEText looks odd to me.
|
# ¿ Oct 26, 2017 18:08 |
|
Sad Panda posted:Could someone point out the glaring mistake in my code? This: Sad Panda posted:
|
# ¿ Mar 18, 2018 02:04 |
|
pathlib is nice if you need to navigate around files and directories a lot, but if you're dealing with a fixed path then you don't really have much use for these Path objects. It also abstracts away a lot of OS specific stuff. os.path can do much of the same things but pathlib has a much nicer API imo
|
# ¿ May 17, 2018 10:41 |
|
Alternatively it seems like a very turtle thing:
|
# ¿ Aug 9, 2018 13:50 |
|
unpacked robinhood posted:I'm trying to apply a function f(x,y) to each possible combination of two strings in a list. Using your d, maybe something like this? Python code:
|
# ¿ Aug 20, 2018 18:24 |
|
Python is changing dramatically, it always been kinda vague but now in 2018 it's clear that "pythonic" has no meaning whatsoever. (yes, I'm looking at assignment expressions here)
|
# ¿ Aug 25, 2018 06:41 |
|
Installing Anaconda seems to be the best solution for this in my experience.
|
# ¿ Sep 26, 2018 21:39 |
|
Jose Cuervo posted:What does this process look like? Get everyone in the class to download Anaconda on day one of the class, then...? Yep, this is what I do.
|
# ¿ Sep 27, 2018 20:34 |
|
Mister Fister posted:I'm learning about regular expressions. With the below expression, i understand the stuff inside the brackets will look to match any upper case/lowercase a-z character, periods, and whitespace while the * is a wildcard. What do the ^ and $ characters indicate? I'm having trouble finding documentation on this. Thanks! Tangential but... To avoid escaping certain characters use raw strings for regex like this: code:
|
# ¿ Sep 30, 2018 11:15 |
|
Boris Galerkin posted:Why does it seem like theres suddenly a drive to static type everything now? I thought not having to do that was one of the core things with python. My impression was that the main motivation for the push on static typing is to provide better hints for bytecode optimization. And yeah, I feel like this push is not really playing with python's strengths but that's like just my opinion. Language design is an ever changing thing.
|
# ¿ Feb 4, 2019 00:31 |
|
|
# ¿ May 3, 2024 07:51 |
|
cinci zoo sniper posted:Cruious - what do you guys think of PEP 572? I feel like it's a terrible idea but I'll surely use it sometimes, it's a feature I abuse a lot in C anyway so... It'll be just like how I use for-else sometimes. It's terrible and dumb but sometimes while typing code I just don't give a poo poo. If the python devs wish to enable my inner perl coder then gently caress the police. edit: https://twitter.com/symbolicbutt/status/1024783816186060800 Symbolic Butt fucked around with this message at 09:43 on Mar 27, 2019 |
# ¿ Mar 27, 2019 09:40 |