__bases__ misleading error message

Mario Figueiredo marfig at gmail.com
Sat Jan 24 16:03:22 EST 2015


In article <mailman.18093.1422127493.18130.python-list at python.org>, 
tjreedy at udel.edu says...
> >         AttributeError: 'Sub' object has no attribute '__bases__'
> 
> In this message, 'Sub' is an adjective, modifying 'object, not naming 
> it.  If you attend to the last line of the traceback
> 

My first reaction is to look at 'Sub' as a noun, not an adjective, since 
I know that NAME well on my code as being a noun. Meanwhile I know that 
objects may be qualified (adjectivized) as class objects or instance 
objects. So, I also happen to look at the word "object" as an adjective, 
as Python object semantics would me do.

What you propose is that I look at that phrase the other way around, 
which is kind of contrarian to how you actually use them in your code.


> >         AttributeError: 'Sub' instance has no attribute '__bases__',
> 
> 'Sub' is an instance of 'type', so "'Sub' instance" could also be taken 
> to mean the class if the traceback were ignored.

I agree. Sub instance is still somewhat ambiguous. So, maybe:

     AttributeError: Instance of object 'Sub' has no attribute 
'__bases__'



More information about the Python-list mailing list