Hello,

I've been following PEP 505 (https://www.python.org/dev/peps/pep-0505/) since 
it was first proposed for Python 3.8. It's been deferred for some time and I'm 
interested in seeing it in Python 3.11, but I know there were also a number of 
objections which resulted in it being deferred (including by one of the 
original authors, Mr. Dower). I did email both Mr. Dower and Mr. Haase and they 
graciously gave me their permission to bring it up on this list for discussion 
and hopefully final pronouncement one way or the other.

I personally believe that the PEP will result in a significant reduction in 
boilerplate code, and it is substantially similar to the same operators now 
found in a number of other languages, especially C# and JavaScript 
(https://wikipedia.org/wiki/Null_coalescing_operator and 
https://wikipedia.org/wiki/Safe_navigation_operator).

I believe strong and valid arguments can be made about the use of None being a 
fundamental flaw in some types of coding (and that adding additional support 
for it to the language will increase the use of None in this way), but I also 
believe there are many use cases in programming where it is by far the simplest 
way to express various semantics, and the fact exists that None is already used 
extensively in large quantities of code, and further that there is already a 
great deal of code written to constantly test against None and break out of a 
statement without throwing an error.

I also understand the argument that especially the maybe-dot (?.) and 
maybe-subscript (?[) operators can decrease readability of code and also 
believe these are valid arguments against it. While I believe the existence and 
use of these operators in other languages definitely helps the case that these 
can be used and understood successfully, I think it is entirely valid to either 
consider other syntax (though I prefer the chosen syntax of PEP 505), or even 
to reduce PEP 505 to having only the coalesce operator (??) and the 
maybe-assign operator (??=).

Separately, I have implemented a pure-Python solution for PEP505 (which is 
definitely rather beta) which might help test the waters for a final 
implementation in CPython (though the CPython implementation would of course be 
much more efficient). It can be found at https://pypi.org/project/pep505/

Thanks,
Doug
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/XZZIV42XGG3EIHRBBCCTTCFPWWSOT7MX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to