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.
15
Upvotes
View all comments
Show parent comment
-1
u/Due_Campaign_9765 Jul 13 '26
I think you're lying. Or not using a type checker so you're not even aware. But that doesn't matter, i'm happy you supposedly never had to access multilevel nullable values. Most people do daily.
Also the SRP doesn't state you what you just stated, you could have at least reread it before doubling down. There isn't anything that "changes" in operators, so it can't coherently apply here.
Not to mention all of those solid principles are quite crap generalization that can't ever be applied universally or near-universally and thus they're useless.