Conversation

Imagine I went on Twitter and made the incendiary statement that Python 3.9.5 has not improved in any way on Python 3.0. Could you prove me wrong? If so, how?
28
76
You’re unable to view this Tweet because this account owner limits who can view their Tweets. Learn more
Replying to and
Additionally, the dictionary union operator (PEP 584, added in 3.9) is just some really nice syntax sugar to have: `d1 | d2` is arguably much more intuitive than `{**d1, **d2}`
3
7
Replying to and
between | and := I feel like a lot of the stuff people are selling python 3 to me on are things that strike me as "perl shit". like originally 18 years ago i dumped perl for python because it didn't have all these super specific operators. why not d1.union(d2)
4
8
I'm not a fan of using operator overloading beyond the standard meaning / definition of the operators. The set operators aren't a case of that though. You could argue having the bitwise/set operators isn't worth it, but there are a lot of types of code where that's commonly used.
Python defines | as union, & as intersection, - as difference and ^ as symmetric difference. a ^ b gives a set with the elements that are in one set or the other but not in both just as it does for bits. >>> 0b1010 ^ 0b1100 6 >>> sum({0b0010, 0b1000} ^ {0b0100, 0b1000}) 6
1
1
Show replies