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

MRAB python at mrabarnett.plus.com
Mon Jul 23 12:58:06 EDT 2018


On 2018-07-23 10:51, Steve Dower wrote:
[snip]

> False: 'a?.b' is totally different from 'a.b'
> ---------------------------------------------
> 
> The expression 'a.b' either results in 'a.b' or AttributeError (assuming
> no descriptors are involved).
> 
> The expression 'a?.b' either results in 'a.b' or None (again, assuming
> no descriptors).

It could still raise AttributeError.
> 
> This isn't a crazy new idea, it really just short-circuits a specific
> error that can only be precisely avoided with "if None" checks (catching
> AttributeError is not the same).
> 
[snip]


More information about the Python-ideas mailing list