To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (…
WTF Python: Exploring and understanding Python through surprising snippets
61–70 of 169 posts
Re: WTF Python: Exploring and understanding Python through surprising snippets
#62To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (…
These problems are applicable to all languages, not just Python.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#63To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (…
> However, know when to be inconsistent -- sometimes style guide recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#64Earlier quoted context omitted.
I'd say it's even deeper - the += operator is fundamentally tied with Python's semantics. Consider: >>> a = [1, 2] >>> b = a >>> a = a + [3] >>> b [1, 2] It has to be [1, 2] because the third line creates a new object. If a + operation changes its operand, then the concept of object identity breaks down - at least, it will be a very different language.
You’re right - I’m not suggesting that `+` should work in-place, but that `a += b` should do the same thing as `a = a + b` and not work in-place.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#65I feel like WTFs caused by doing something deeply weird hardly counts against the language. Yes doing the walrus operator inside brackets works. Yes of course it's going to be doing weird things. Is this really surprising to anyone? It's not what that operator is for . Yes comparing strings with "is" works sometimes . It's not checking equality and it isn't supposed to. In another implementation using "is" might work…
> I've been seeing a growing anti-python sentiment lately Not speaking for the quality of the article, but on that sentiment: maybe it's just that the pro-python sentiment is eroding. I'm glad it's becoming kind of ok to criticise that language, after years of it being untouchable (at its core, not the 2 -> 3 migration). At least that's my sentiment as someone who really doesn't like it (but I'm a professional, I sti…
I've only been following Python for a little over 20 years of it's ~30 year life, but I don't remember it ever being “untouchable”, or even just “untouched” by criticism.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#66To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (…
In some contexts, that slight mismatch can escalate to become quite wide.
A deeper examination of Django would yield rich examples of this.
------------
The above is really a message for myself as an engineer who loves python and has an emotionally visceral distaste for PHP. I offer it to y'all in case you also find it useful insight.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#67You get less criticism about other languages although they also have bad design decisions (which is totally fine since nothing is perfect).
I wish these things weren't so biased by the emotional investment people put in working tools, which is all a language is.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#68To be frank I think the python community lacks self-awareness. There's this ritual you have to do when learning python: blindly accept status-quo design choices as "universally good" (but call it "pythonic"), and crap on other languages. Never admit python or the ecosystem has issues or shortcomings, and if another language has something better than yours (eg, Yarn, or Composer is way better than anything in Python (…
Python can’t seem to decide whether it wants to be a production grade language or easy-for-beginners and keeps implementing pointless features (looking at you walrus operator and weird version or pattern matching) instead of fixing its actual problems like the tire-fire that is packaging and performance.
“But Python has never been about performance” someone will say, and that’s fine, but it’s increasingly becoming a language that isn’t any more ergonomic to use than its peers, with worse packaging and deployment, useful tools (type hunting) that the community seemingly refuses to adopt widespread and its slower on top of all that?
Why would you actually bother?
Re: WTF Python: Exploring and understanding Python through surprising snippets
#69I feel like WTFs caused by doing something deeply weird hardly counts against the language. Yes doing the walrus operator inside brackets works. Yes of course it's going to be doing weird things. Is this really surprising to anyone? It's not what that operator is for . Yes comparing strings with "is" works sometimes . It's not checking equality and it isn't supposed to. In another implementation using "is" might work…
>> none of the code on this page is something anyone would actually write in production code on purpose.
I mostly agree, but there is one example where I thought it is important to know and remember:for x in range(7): def some_func(): return x
Here x binds to the (outside) symbol x, not the value of x at creation time of the inner function.
Re: WTF Python: Exploring and understanding Python through surprising snippets
#70I feel like WTFs caused by doing something deeply weird hardly counts against the language. Yes doing the walrus operator inside brackets works. Yes of course it's going to be doing weird things. Is this really surprising to anyone? It's not what that operator is for . Yes comparing strings with "is" works sometimes . It's not checking equality and it isn't supposed to. In another implementation using "is" might work…
>> none of the code on this page is something anyone would actually write in production code on purpose. I mostly agree, but there is one example where I thought it is important to know and remember: for x in range(7): def some_func(): return x Here x binds to the (outside) symbol x, not the value of x at creation time of the inner function.