[Python-ideas] Object grabbing

Erik python at lucidity.plus.com
Mon May 2 18:06:04 EDT 2016


On 02/05/16 23:00, Joshua Morton wrote:
> It should be a name error, perhaps 'Accessed object's name cannot be
> inferred', or a similar error to UnboundLocalException.

You are missing the point.

It is not reasonable to expect an error to be generated at compile time: 
because the compiler has no way of knowing what attributes will exist on 
the objects at runtime.

It is not reasonable to expect an error to be generated at runtime: 
because each and every object would have to be queried as to whether 
they have the attribute to know if there is ambiguity on each and every 
reference to an attribute.

The question of which error or warning or exception should be generated 
is moot ;)

E.


More information about the Python-ideas mailing list