r/Python • u/philtrondaboss • Jul 12 '26
Discussion Will PEP 505 ever be accepted?
https://peps.python.org/pep-0505/
I don't understand how null safe operators are less like plain English than other implemented features like the walrus operator.
In my opinion, the member access operator would make python significantly easier to read and understand.
Here's an example:
f = foo()
if f is None:
baz = ""
else:
baz = f.bar()
baz = foo()?.bar() ?: ""
EDIT: I forgot that "and" and "or" can be sometimes used in place of "?." and "?:" if the left value is not False, '', 0, [], or {}. It's a very implicit null check and has a lot of unexpected behavior.
18
Upvotes
View all comments
Show parent comment
2
u/FrickinLazerBeams Jul 15 '26
A language doesn't need to constantly add new syntax to remain healthy. That doesn't make any sense. If a language adds syntax forever - without limit - it will eventually turn into a complicated mess, with multiple ways of doing the same thing, wildly varying best practices, will become difficult to learn, hard to read because every developer will use different wacky syntactic patterns... What a nightmare.
Python can advance without yet another goofy operator that performs an assignment on Wednesdays and tests for equality on Friday, while also returning a dict that contains the assigned object and a ham sandwich. Not a bit of this shit is solving a problem that exists.
It's also extremely un-Pythonic. Originally there was a principle that in Python there should be one and only one way to do something and it should be pretty obvious. Now we have a whole bunch of extra junk that does... What? Reduces a few lines of code into one and make them harder to read? No thanks.
Python has lots of ways to improve and grow without altering syntax. It can add performance, improvements to the standard library, and probably a dozen other things I can't think of right now.