If you need to see this to believe it, try running this code which does the same comparison between 50,000 items (which is much faster but still takes nearly a minute for the list scenario.
This will run each scenario & print how fast each took.
@daniellindsley I categorize that under 2, but you're right that overloading of operators & built-in functions in particular is quite novel when mixing from many languages.
🤔 I am sure it will take me a while to update my various email and social media footers, but my ~5-year term as @ThePSF director and vice chair ended today.
🙏 It was an honor to serve, work with everyone, and leave a small mark on the community and our direction.
👟 If you are a runner and have ever finished a race a little faster than you thought you could or met a new distance goal and surprised yourself, that's how I feel today. ❤️
In Python we tend to use ALL_CAPS for constant variables.
Keep in mind that this is just a convention though. Python doesn't actually have constants.
Python DOES have immutable objects, but those are different from constants.
Remember, #Python has 2 types of change: mutations change objects and assignments change variables. A true constant variable (not Python's) cannot be re-assigned while an immutable object cannot be mutated.
@spencer@diazona when describing the nature of Python's variables, I usually use the terms "point" and "pointer", though reference and bind seem like fine terms (though less visually obvious to beginners).
I wonder if there's room for something between short tutorials and courses. Maybe "recipes" where I just show how to do common intermediate-ish Django tasks, but don't have to explain all the steps the way I normally do? So not docs that are abstract, still step-by-step, but more like here's the recipe and there are links to go deeper on the "why" if you need it.
@kleaders It may seem odd to copy-paste your way from a loop, but it's not meant to be a permanent technique.
The idea is to anchor what you're less familiar with (the comprehension) on the syntax of what you know (the loop).
The syntax is weird! It uses the keywords "for" and "if", which makes it look like an inside-out "for" loop, even though it's really something separate.
@kleaders@meejah big +1 to breaking over multiple lines. I pretty much always prefer that.
Something to note is that unfortunately using the Black autoformatter will turn them back to one-liners unless they're over the maximum like length you have set. 😢