[Python-ideas] PEP 505: None-aware operators

Chris Angelico rosuav at gmail.com
Sat Jul 28 16:14:47 EDT 2018


On Sun, Jul 29, 2018 at 6:07 AM, Abe Dillon <abedillon at gmail.com> wrote:
> Yes, I thought of that and came to the same conclusion. It's my
> understanding that None may not be an actual object, but a special memory
> location. I'm not sure though and didn't look it up.

Python does not have memory locations. None *is* an actual object. It
has attributes, it has standard behaviours, it fits in the same object
model as everything else in Python does.

>> As you said, "?" is not an operator, so "a?.b" clearly can't break down
>> into "a? .b".
>
>
> The problem is that '.' IS a stand-alone operator, so it's natural to
> visually parse `<expr>.b` as `<expr>  .b`, but adding '?.' causes double
> takes, more mental load, general interruption of the flow of reading. It
> also sets up the later discussion of other possible uses of the '?' symbol
> that may or may not have more merit.

This is utter nonsense on par with trying to claim that "x <= y"
should be parsed as if it's a modified form of assignment since "x =
y" would be assignment.

Do I really need to explain how two-character operators work?

ChrisA


More information about the Python-ideas mailing list