17 ms·
Python 3.9
- ed25519FUUU 6y ago> "foobar".removeprefix("foo") I can't say how much of a nice improve removeprefix() and removesuffix() is. lstrip and rstrip prefix and suffix trimming bugs crop up in people's code constantly. This seems like a nice change, especially since the alternatives are so ugly.
- ju-st 6y agoThey got rid of the super ugly [:] but introduced a new ugliness.. | and |= operators for dictionaries. Why is this so important that this needs special operators? Python should be readable by everyone who can understand English. I hate when languages keep inventing hieroglyphs, twisting my fingers to type |= takes even longer than typing .join.
- renewiltord 6y agoYou can still do `a.update(b)`
- duckerude 6y agoThe existing alternative to `a | b` was {**a, **b} You could see this as an improvement.
- edgyquant 6y agoAs someone who started out in C I love the pointer style syntax
- rmtech 6y agoOh my god yes.
- philsnow 6y agoas pointed out elsewhere in this thread, `"a" or "b"` evaluates to "a", which kind of makes me think that `a | b` (with a and b as dicts) would take values for overlapping keys from a, not from b. The dict literal with dict-splats conveys a sense of ordering that makes the behavior of taking values for overlapping keys from the lattermost dict make more sense to me.
- meowface 6y agoThis is my favorite change in this release and cause me to upgrade to the RC version a few days ago. It's a huge QoL improvement for so much code I write. I'm also a fan of the walrus operator. These are small, rare, clear, useful, idiomatic new features, in my opinion.
- smitty1e 6y agoIt is outstanding that that the new features have an audience. One frets that Python could become a victim of 'featuritis' as the devs try to shop for a new kitchen sink for each release.
- fireattack 6y agoI personally feel walrus operator is a much more prominent improvement, considering how prevalent it can be used (like, I use it in almost every single `re.search()`, and at least half of conditional list comprehensions and `while`), while I don't find the old way of updating dict (`{a, b}` etc.) too bad. But of course, both are very welcomed!
- amelius 6y ago> They got rid of the super ugly [:] What do you mean by that? Can't we clear a list by doing: L[:] = [] (useful when L is defined in another scope, or when you want to keep a reference to the same list object) Unfortunately it's not possible to search for "[:]", so pointers appreciated
- ed25519FUUU 6y agoWait, why not just L.clear()?
- amelius 6y agoGood point. But you might still want e.g.: L[1:] = []
- ju-st 6y agoI just meant that you need the "[:]-operator" less often because of the new methods removeprefix, not that the thing is completely removed.
- kevin_thibedeau 6y agoThey already existed for sets and some people want dicts to have analogous behavior.
- irrational 6y agoI feel the same way about -> in JavaScript. You would think after all these years I'd have come around by now. Nope, I'm still pissed off about that decision.
- gecko 6y agoHuh? What's this do in JavaScript? (No sarcasm; I'm mostly in this ecosystem, but I have no idea what this is in reference to.)
- irrational 6y agoThey are called arrow functions (-> looks a bit like an arrow).
- ZephyrBlu 6y agoIt's confusing to write it like -> because the actual operator is =>, which is close but not the same.
- arthurcolle 6y agoisn't it =>
- jakogut 6y agoI find this operator intuitive and idiomatic. It's widely understood and used as a binary OR operator in many languages, and it's easy to understand its functionality when both operands are dictionaries.
- nneonneo 6y agoIt’s also already an established part of the set syntax - it’s been possible to ^, | and & sets for a while now (symmetric difference, union and intersection). While not all of those make sense for dicts, | for union does and is quite intuitive.
- sgdpk 6y agoIt's also consistent with the set notation, which makes it easier to remember. Dict keys already kind of work like a set, this extends the behavior to deal with the values as well.
- saiojd 6y agoIt's not introduced at all, its already there for sets
- doc_gunthrop 6y agoIt doesn't replace the `lstrip` or `rstrip` methods; it replaces the need for an `if` statement using `startswith` and `endswith` methods. if "foobar".startswith("foo"): "foobar"[len("foo"):]
- deleted 6y ago[deleted]
- quietbritishjim 6y agoThe parent comment referred to bugs from use of lstrip and rstrip for this purpose. The problem is that they often appear to work for this job, so they can make it all the way into code. Your own example strings illustrate that: > "foobar".lstrip("foo") "bar" Of course, if the developer making this mistake tested with "foofbar" instead then they would realise their mistake. A more typical example of this type of mistake would be url.lstrip("http:// http://").
- doc_gunthrop 6y agoIf the developer is using str.lstrip or str.rstrip, they're doing it wrong (because they're using the wrong method). > "foobar".lstrip("wooowweeezoweeef") bar
- vultour 6y agoYes, that's what both comments you replied to have said.
- digianarchist 6y agoThat always bites people. `lstrip` and `rstrip` take a set of characters to be removed not a prefix/suffix. >>> "foobarbaz".lstrip("fo") 'barbaz'
- gorgoiler 6y agoTimezones! Actual jurisdictional timezones, as in tzdata’s Europe/Lisbon! Hooray! https://www.python.org/dev/peps/pep-0615/#id7 https://www.python.org/dev/peps/pep-0615/#id7
- gojomo 6y agoIs there a backport for earlier Python 3.x versions?
- x1798DE 6y agoYes: https://pypi.org/project/backports.zoneinfo/ https://pypi.org/project/backports.zoneinfo/
- tialaramex 6y agoYes! The Olson Database is the Right Thing™. Timezones are a weird human artefact, but ordinary humans have no idea what ZQMT or whatever actually "is" and will make loads of egregious mistakes if exposed to these zones directly even if your UX isn't terrible (which it probably will be). But humans do understand what a city is, and if they live in or near one they understand what the time is in that city, adjusting for any weird local political rules like "Daylight saving" because those rules affect their life. It's the right granularity practically too. Can politicians decide that Dublin and Belfast are in different timezones? Yeah, it'd be difficult but I think they could make that happen. How about Queens and Brooklyn? Ahahaha No. The residents will defy any pretence that clocks change between one city block and the next, it would never stick.
- IgorPartola 6y agoYes. When applications ask me what timezone I am in and simply give me the offset I get very nervous. Especially since they are usually event scheduling or email sending services where timing actually matters a lot.
- JetSpiegel 6y ago> The residents will defy any pretence that clocks change between one city block and the next, it would never stick. Going from the example of "Europe/Lisbon", Valença and Tui have 1h of difference, but are located on the same longitude, <3km from one another... - https://en.wikipedia.org/wiki/Valen%C3%A7a,_Portugal https://en.wikipedia.org/wiki/Valen%C3%A7a,_Portugal - https://en.wikipedia.org/wiki/Tui,_Pontevedra https://en.wikipedia.org/wiki/Tui,_Pontevedra
- tobltobs 6y ago> https://docs.python.org/release/3.9.0/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code https://docs.python.org/release/3.9.0/whatsnew/3.9.html#you-... Compared to Python, good old Windows DLL hell looks like a paradise to me.
- karlicoss 6y agoI'm excited about PEP 585 https://www.python.org/dev/peps/pep-0585/ https://www.python.org/dev/peps/pep-0585/ Now you can use list, dict, tuple instead of typing.List, typing.Dict, typing.Tuple.
- ZephyrBlu 6y agoThis is what put me off using type hints. Now I think I might actually add them to my code.
- gnulinux 6y agoWhy wasn't done in the first place? What was the rationale of using typing.List? Did they want to reserve `dict[x]` for some other semantics?
- ddavis 6y agoThe PEP abstract says this: "Static typing as defined by PEPs 484, 526, 544, 560, and 563 was built incrementally on top of the existing Python runtime and constrained by existing syntax and runtime behavior"
- renewiltord 6y agoWell, `list` and friends were functions to construct those objects. So presumably they did it this way to prioritize adding typing over getting it perfect. I think it was the right choice.
- stefano 6y agoIt was a problem only because somehow they decided that type annotations should evaluate to something meaningful at runtime, instead of being a compile-time only construct like in every other language.
- smitty1e 6y ago"Somehow they decided" is rooted in the desire to make typing optional, and absolutely not a requirement.
- devwastaken 6y agoDo we have full subinterpreters support yet? It appears this update impliments seperate schedulers now, but not sure if that means we can run as independent threads or if they're still bound by the main thread.
- jnwatson 6y agoDelayed until 3.10
- rattray 6y agoGiven that it was released as stable today (Oct 5th 2020), should the title be "Python 3.9 Released" ? EDIT: Previously had a typo "3.8" instead of "3.9", my apologies.
- edgyquant 6y agoThis is about 3.9, I don’t think it’s stable yet. I’m just upgrading to 3.8 today.
- rattray 6y ago3.9.0 was released as stable today: https://www.python.org/downloads/release/python-390/ https://www.python.org/downloads/release/python-390/ > Release Date: Oct. 5, 2020 > This is the stable release of Python 3.9.0
- toyg 6y agoWait until you read that they’re moving to yearly releases... I love python but these short release cycles can be really annoying.
- lhoff 6y agoAccording to the Guideline "please use the original title, unless it is misleading or linkbait; don't editorialize" the Title should be "What’s New In Python 3.9"+ https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- hyperrail 6y agoRight now, the link title is not even that, but just "Python 3.9". I wouldn't be surprised if it was an after the fact change; I've observed that HN admins never let "X Y.Z Released" or "What's New In X Y.Z" headlines stand but change them to "X Y.Z" or even just "X" almost immediately. It's a strange HN-ism that puzzles me - "OK, what's so important about Foo 3.14?" There is a rule that is (barely IMO) on point though in the posting guidelines you linked to: > If the title begins with a number or number + gratuitous adjective, we'd appreciate it if you'd crop it. E.g. translate "10 Ways To Do X" to "How To Do X," and "14 Amazing Ys" to "Ys." Exception: when the number is meaningful, e.g. "The 5 Platonic Solids."
- divbzero 6y agoA few of the good tidbits in this release: – zoneinfo – dict update operators – str.removeprefix and str.removesuffix – “Any valid expression can now be used as a decorator. Previously, the grammar was much more restrictive.” – “Python now gets the absolute path of the script filename specified on the command line (ex: python3 script.py): the __file__ attribute of the __main__ module became an absolute path, rather than a relative path.” On the last one I rarely if ever use __file__ as a relative path and have definitely typed os.path.abspath(__file__) many many times.
- jxramos 6y agonice, removeprefix/suffix is so pythonic. Great addition I've seen handrolled implementations of that go buggy because they happened to work in some cases but broke others.
- user5994461 6y agoThe same can be done with lstrip("prefix") and rstrip("suffit") for most use cases.
- brilee 6y agoIt doesn't do what you think it does. From https://www.python.org/dev/peps/pep-0616/#rationale https://www.python.org/dev/peps/pep-0616/#rationale "There have been repeated issues on Python-Ideas [2] [3], Python-Dev [4] [5] [6] [7], the Bug Tracker, and StackOverflow [8], related to user confusion about the existing str.lstrip and str.rstrip methods. These users are typically expecting the behavior of removeprefix and removesuffix, but they are surprised that the parameter for lstrip is interpreted as a set of characters, not a substring."
- deleted 6y ago[deleted]
- ATsch 6y agoNo, this is exactly the common coding mistake removeprefix/suffix is here to adress. The strip() family removes all characters in the string you pass, so it removes not just "prefix" but also "efix", "prefixix" and "effxpixpefiii".
- vivekhaz 6y agoI wonder if topological sort being built into Python will increase the prevalence of more obscure graph problems for companies that make search engines and the like.
- The_rationalist 6y agoa number of Python builtins (range, tuple, set, frozenset, list, dict) are now sped up using PEP 590 vectorcall; I wonder how much vectorcall improve performance in standard code
- qeternity 6y agoWe’ve not had a chance to properly benchmark because one core dep isn’t compatible but the benchmarks I’ve seen suggest that it’s actually slower overall, but that’s expected to improve.
- andreasvc 6y agoI'm puzzled by this example: sums = [s for s in [0] for x in data for s in [s + x]] Why would you do "for s in" twice? Is that intentional? It would make more sense to me if the variables would have been different. And why would you want to add 0 to numbers?! Curious about a real world use case for this.
- megaman821 6y agoIt is a nested loop. I don't find it very readable but the single line formatting makes it worse.
- duckerude 6y agoI wouldn't endorse that code, but it does make sense. You can read it like this: sums = [] s = 0 for x in data: s = s + x sums.append(s) `for s in [0]` assigns 0 to `s`, as an initial value. `for s in [s + x]` adds `x` to `s`. Both instances of `s` are the same variable, there's no shadowing going on.
- andreasvc 6y agoAh, I see. That really doesn't deserve to be called an idiom, it's a clever hack. But it's nice to know about it. It seems less ugly than the walrus operator to me, and it doesn't leak the variable outside of the comprehension.
- deleted 6y ago[deleted]
- nurettin 6y agos for s in [0] # for every s of 0 (there is only one) for x in data # for every x in data for s in [s + x] # s is s + x. so s = 0 + x[0], then s = (0 + x[0]) + x[1], then (0 + x[0] + x[1]) + x[2] it results in an array of rolling sums. Edit: someone already answered, I am blind.
- GloriousKoji 6y agoLots of great improvements. Sadly I won't get to enjoy the new string methods, dict operations and generic hinting as I'm still stuck writing code that should be compatible with older versions of 3 (and 2.7 but six takes care of that).
- AdamN 6y ago3.5 is the minimum supported version. Make sure the powers that be know that there is little logic in supporting 3.4 or below.
- duckerude 6y ago3.6 as of a few days ago: https://mail.python.org/archives/list/python-dev@python.org/message/YKZON55BE5JMK6355KPD53HRUXOOYTYN/ https://mail.python.org/archives/list/python-dev@python.org/...
- uyt 6y agoThey added a memoize decorator: https://docs.python.org/3.9/library/functools.html#functools.cache https://docs.python.org/3.9/library/functools.html#functools... Pretty useful for DP interview questions when implementing top down.
- codethief 6y agoI find it weird that they called it `cache` instead of `cached` which would be more in line with `cached_property`. One of my colleagues already tripped over this today when he told me about this new feature.
- bobbylarrybobby 6y agoPython has a lot of weird naming choices. Heck, they didn’t even Putin underscore in their new string method `removeprefix`
- dec0dedab0de 6y agoWell one is a type of property and the other is saying cache what I'm decorating
- delaaxe 6y agoThey wanted to match `@functools.lru_cache`
- rhencke 6y agoWhile nice, this isn't new. This is just a convenience for 'lru_cache(maxsize=None)'. lru_cache has been supported since Python 3.2. See: https://docs.python.org/3.2/library/functools.html#functools.lru_cache https://docs.python.org/3.2/library/functools.html#functools...
- nneonneo 6y agoThey do mention that it’s more efficient than lru_cache, which isn’t surprising since cache is a lot simpler (just throw all the values in a dict keyed by the args).
- typon 6y agoIt must feel great to be a Python Core Developer. A 1% perf improvement in any part of the language translates to billions of CPU hours saved around the world.
- musicale 6y agoUnfortunately even with Python 3.9 you might still need 10-100x as many servers as you would if you used C++. :( disclaimer: I like Python and find it a lot more fun than C++, although C++/STL are getting better over time!
- pjmlp 6y agoThat wouldn't be the case if there was more JIT love.
- TazeTSchnitzel 6y agoAs PHP discovered, JIT is not a magic button. If you don't have efficient data structures and memory use, JIT won't do much for code that isn't just raw number-crunching.
- typon 6y agoGet the best of both worlds with pybind11 ;)
- fulafel 6y agoYou might.. but more probably you need infinitely more servers. (Because the C++ program is too hard to write and doesn't come into existence!)
- deleted 6y ago[deleted]
- baq 6y agoPerhaps interesting: Python 1.0 and STL were released/standardized in the same year - 1994.
- klyrs 6y agoThe performance table seems to show a huge amount of regression -- a notable example, reading bound methods is almost twice as slow vs 3.8. Does anybody know if this is normal for early releases like this; will we see those numbers improve over time?
- lordgilman 6y agoThe issue was noticed before 3.9 came out, but I guess it wasn't a big enough deal to blog the release. Hopefully it's just a measurement problem. https://bugs.python.org/issue39117 https://bugs.python.org/issue39117
- MichaelMoser123 6y agois the performance of the PEG parser really comparable to that of LL(1)? PEG would do a whole lot more backtracking.
- pansa2 6y agoPython's LL(1) parser isn't particularly fast. It's not a recursive-descent parser custom-made for Python's grammar, but a data-driven general-purpose design. What's more, it's not driven by a simple LL(1) table but by more complex data: a set of DFAs.
- luord 6y agoFlexible function and variable annotations. Oh, I feel we're going to have so much fun together. That's probably gonna be very useful when reusing types with different libraries (such as ORMs or serializers). I think anyway, gonna have to experiment.
- toyg 6y agoThere is a more detailed overview of some of the new stuff here: https://realpython.com/python39-new-features/ https://realpython.com/python39-new-features/
- cma 6y agoEww.. This isn't new in 3.9, but is mentioned in the dict section as an existing quirk of sets I didn't realize this: >>> {0} | {False} {0} >>> {False} | {0} {False}
- emptysea 6y agoNever seen that before. Neat how the bool being a subclass of int pokes out in various ways. A nice side effect is that bools can used with sum: sum(x % 10 for x in range(1000))
- raziel2p 6y agoBad example? x % 10 does not return a bool.
- emptysea 6y agoWhoops! For future internet historians, it should have been: sum(x % 10 == 0 for x in range(1000))
- eesmith 6y agoIt's not really a bool/int subclass issue but one of hash() and equality. >>> {1} | {1.0} {1} >>> {1.0} | {1} {1.0} >>> import fractions >>> x = fractions.Fraction(1) >>> {x} | {1} {Fraction(1, 1)} >>> {1} | {x} {1}
- bobbylarrybobby 6y ago0 == False, right? So any set-like container that uses == and not `is` for equality checks would have to only ever include one of 0 and False. This seems fine to me.
- mFixman 6y agoThis should stop in a type error just like `0 + False` or `1 + "1"`. This code is almost always a programmer error.
- tbenst 6y agoThe biggest change by far is to process not code: https://www.python.org/dev/peps/pep-0602/ https://www.python.org/dev/peps/pep-0602/ I have mixed feelings about a 12 month development cycle. From the perspective of a library maintainer but not a core contributor, this seems like a headache to support up to five versions concurrently. I understand we want to avoid the Python 2.7 debacle, but seems pretty rapid no?
- MeteorMarc 6y agoDo you mean external library? Then you are free to choose the python versions you support.
- medecau 6y agoTox makes it easy to run the test suite on multiple versions of python. https://tox.readthedocs.io/en/latest/ https://tox.readthedocs.io/en/latest/
- cdaven 6y agoHave a look at Typescript's hectic release schedule: - 3.1 in September 2018 - 3.2 in November 2018 - 3.3 in January 2019 - 3.4 in March 2019 - 3.5 in May 2019 - 3.6 in August 2019 - 3.7 in November 2019 - 3.8 in February 2020 - 3.9 in May 2020 - 4.0 in August 2020 I'm not saying that this doesn't cause headaches, but do we really want less progress?
- draegtun 6y agoPerl has been on a 12 month development cycle so some years (since perl 5.12 i think which would be from 2010). I seems to have worked out well but they only support the two most recent (stable) versions - https://perldoc.perl.org/perlpolicy#MAINTENANCE-AND-SUPPORT https://perldoc.perl.org/perlpolicy#MAINTENANCE-AND-SUPPORT
- musicale 6y agoI'm still waiting for this: print "Hey, they brought back the print statement!" print("But you can still call the print() function!") print ("printing", "tuples", "works", "like", "python2") It would be a massive QoL improvement and also accelerate Python 3 adoption. (I'd actually be OK with allowing keywords to be used as method/function names in general, but that's a more extensive change than from __past__ import print_statement )
- typon 6y agoI'm so extremely glad they got rid of the print statement. Was an ugly part of the language, and added keywords to python that didn't need to exist. I think they should get rid of the assert statement too and turn it into a builtin.
- musicale 6y agoThe print statement is/was a beautiful thing that dates to antiquity (e.g. Python 1 and BASIC), and one that many people loved. It was also used extensively. Removing it (and breaking compatibility in general with no easy workarounds) is one of the major footguns in Python 3 that drastically slowed its adoption and basically forked the language. It's a prime example of ideology trumping usability and practicality, resulting in the waste of probably millions of programmer hours, and orphaning millions of lines of code in Python 2 programs and libraries. Other languages have managed to evolve effectively for decades without breaking backward compatibility; it's disappointing and embarrassing that Python simply hasn't.
- rsfern 6y agoHistory/preference aside, I think you’re being a bit hyperbolic regarding the cost of removing the print statement. It’s like the most trivial broken feature to fix with 2to3. I’ve definitely run into issues 2to3 couldn’t automatically fix (encoding issues in some py2-only lib I needed to use IIRC), but upgrading print doesn’t really have much overhead.
- 6y ago
- jbmsf 6y agoI no longer have to implement Kahn's algorithm twice a year!
- MoodyMoon 6y agoWindows 7 support is also dropped in this release. https://bugs.python.org/issue32592 https://bugs.python.org/issue32592
- cozzyd 6y agoWindows 7 still has 25% market share, apparently, at least according to https://netmarketshare.com/operating-system-market-share.aspx https://netmarketshare.com/operating-system-market-share.asp... (no clue if that's a reasonable source or not, but probably not TOO ring). Seems a little premature to drop support?
- nanagojo 6y agoWindows 7 EOF was January 14, 2020
- user5994461 6y agoWindows 7 is supported until 2023.
- nly 6y agoNo, that's Windows 8.1. Windows 7 is toast. See here: https://support.microsoft.com/en-gb/help/13853/windows-lifecycle-fact-sheet https://support.microsoft.com/en-gb/help/13853/windows-lifec...
- user5994461 6y agoNo, Windows 7 is still supported until 2023. At at minimum for all companies that are paying for windows support automatically. As a consumer, I have an old Windows 7 laptop that I use once a month or less (don't need to travel much lately). I can tell you that it's been continuing to run windows updates all year long after the EOL. It's a major issue for me to use the laptop because it's running updates for hours whenever it's taken out of storage :(
- Sami_Lehtinen 6y agoFinally IPv6 scoped addresses, thanks!
- pmlnr 6y agoAs a sysadmin who needs to prepare literal thousands of finicky packages with each major version, I'd love to return to the C release cycle of ~10 years.
- probably_wrong 6y agoI'm with you there. A programming language is my tool, not my destination. I shouldn't have to keep learning how to hold my hammer every six months nor have to go back to every house I ever built to replace the nails every year. There is value to being able to say "I'm done" and walking away knowing my code will happily chug along for the next 20 years.
- DougBTX 6y agoYeah, interesting reading through the list of "Removed" features. On one hand, it is nice to tidy things up, on the other hand, I'm wondering, was it really worth breaking backwards compatibility for these things?
- raziel2p 6y agoWhat packages? Sounds like a process ripe for optimization.
- radmuzom 6y agoHa... I had asked a question in Quora several years back on exactly the same topic (deleted account, don't have link). I don't understand why programming languages need to be released like other "software". I see it a lot for modern languages like Rust. To me, a programming language should have a major revision only once in 5-10 years. All other changes should be performance improvements or implementation changes which do not affect the end user which in this case is the programmer.
- takeda 6y agoYou should just let developers use virtualenv and then let them install packages through pip, or let them use tool like poetry which makes the experience even better. This makes life easier for both sides. If you use RedHat or CentOS I would highly recommend ius.us repo, it contains latest versions of python and it's pretty much all what's needed.
- tutfbhuf 6y agoI'm excited about Python 4.0
- mkl 6y agoYou're in for a long wait. Next up is 3.10. See e.g. https://www.python.org/dev/peps/pep-0623/#python-4-0-is-not-scheduled-yet https://www.python.org/dev/peps/pep-0623/#python-4-0-is-not-...
- nnm 6y agoIn Python "a" or "b" returns "a". If you read the dict union operator "|" as something similar to "or", (like me), you are in for a surprise: >>> x = {"key1": "value1 from x", "key2": "value2 from x"} >>> y = {"key2": "value2 from y", "key3": "value3 from y"} >>> x | y {'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'} What I expect is >>> x | y {"key1": "value1 from x", "key2": "value2 from x", "key3": "value3 from y"}
- Doxin 6y agoIt operates similarly to bitwise or, combining all the set bits, or like the or operator on sets, combining all the set elements. "|" has never meant logical or in python nor in most other common programming languages.
- quietbritishjim 6y ago[Edit: I thought the parent comment was saying that they were expecting dict1 | dict2 to equal either dict1 or dict2, not some combination of them. Instead, they were referring to the which value gets chosen if the same key is in both dictionaries. Thanks to minitech for their comment that helped me see what they were saying.] Are you also surprised when the original bitwise meaning of "|" does not return either of the two arguments? >>> 5 | 3 7 Here's the same thing as binary: >>> bin(0b101 | 0b011) '0b111'
- 6y ago
- guram11 6y ago> Using NotImplemented in a boolean context has been deprecated I've always wonder why NotImplemented is used in a boolean context in the first place, iirc when it evaluates to True the overrided comparison now becomes a source of hard to spot bug