Yeah you can technically craft such pathological edge cases but this is already 
heavily discouraged. Libraries that change the usual semantics of python's 
object model are rare.

The only exception I can think of would be numpy which disallows truthiness 
checks because of the ambiguity of arrays being both scalars and containers. 
However, this means that the "if x := get_some_array():" construct is already 
ill-formed so nothing would change by generalizing the left side to arbitrary 
patterns. And since numpy arrays aren't proper Sequence types you can't use 
them with the current implementation of pattern matching anyway.

So besides carefully crafted pathological edge-cases the "if (...) is not None" 
construct would be completely redundant.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/332DUWASBGXRPUHQN2AVEKTV2ASILKLB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to