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.
17
Upvotes
View all comments
Show parent comment
6
u/Due_Campaign_9765 Jul 13 '26
Are you sure you're not lost? Those defences smell like r/golang :)
I really don't get why people are so vehemently against adding obvious, useful and harmless language features.
At least i somewhat get golang's philosophy "We're google, we hired a bunch of fresh grands who are idiots and we don't want them shooting themselves in the feet (and also introduced channels that shouldn't be used 99.9% of the time so that they can shoot in their feet anyway)".
Why a rando on reddit would basically say "we're too dumb to parse an additional symbol so instead we're going to write wrappers or do 5 line null check for every field access" i've no idea, i'll be honest.