>Gerald Britton wrote:
>> I now understand the Python does
>> not consider a class definition as a separate namespace as it does for
>> function definitions.  That is a helpful understanding.

>That is not correct.  Classes are separate namespaces -- they just
>aren't automatically searched.  The only namespaces that are
>automatically searched are local, non-local, global, and built-in.

I see you misunderstood my observation:  Python does not consider a class
definition as a separate namespace *as it does* for function definitions.

Of course classes are separate namespaces, or they would not work at
all.  However,
Python does not automatically search class namespaces -- even within the class
definition -- *as it does* within function definitions.

That is the key insight I was seeking.  To search a class namespace one must
qualify the lookup with the class or instance name.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to