Zero Piraeus writes:
If I write something like obj.attr, the failure mode I care about is
that
obj has no attribute attr, rather than that obj is specifically None (or
one of a defined group of somewhat Nonelike objects).
Clearly, in such a circumstance, obj is not what I expected it to be,
because I thought it was going to have an attribute attr, and it
doesn't.
If it's an error, you shouldn't be trying to do anything
about it, just let the exception happen.
The proposed .? syntax is designed for cases where it's *not*
an error for the object to be missing the attribute, *and*
the correct action in that situation is to skip whatever
you would have done otherwise.
What needs to be decided is whether such use cases are frequent
enough to justify special syntax.
--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
Matt Gilson // SOFTWARE ENGINEER
E: matt@getpattern.com // P: 603.892.7736