__bases__ misleading error message

Mario Figueiredo marfig at gmail.com
Sat Jan 24 23:09:02 CET 2015

In article <mailman.18099.1422135976.18130.python-list at python.org>, 
ian.g.kelly at gmail.com says...
> On Sat, Jan 24, 2015 at 2:14 PM, Mario Figueiredo <marfig at gmail.com> wrote:
> > But that begs the OT question:
> No, it doesnt. http://en.wikipedia.org/wiki/Begging_the_question


> I'm not sure I'm understanding what you're asking, but the import
> statement imports the module, looks up "a_name" in that module's
> globals dict, and binds the same object to a_name in the current
> module's globals dict.

Meaning the interpreter knows a variable's name. Which would allow it to 
produce an error message such as:

    AttributeError: 'foo' object has no attribute '__bases__'

For the following code:

    class Sub:
    foo = Sub()

More information about the Python-list mailing list