FEEDBACK WANTED: Type/class unification

Guido van Rossum guido at python.org
Fri Aug 24 20:34:47 CEST 2001


> I just stumbled over one of the changes in 2.2 when I got the message:
> 
> TypeError: unbound method option_value() must be called with instance
>     as first argument 
> 
> The reason for this TypeError is that my code tried to call a method
> of the wrong class -- probably an oversight when I changed the
> superclass and didn't update all references to the old superclass. As
> that method ultimately comes from the same mixin it worked fine until
> now.

Right!  I found a similar bug lurking in IDLE when I tightened the
rules for this case.

> The behavior of Python 2.2 is fine -- it told me about a potential
> error which had been lurking for a long time. The problem is that
> the error message is misleading -- the first argument is an instance. 
> 
> It would be more informative if the message looked something like:
> 
> TypeError: unbound method option_value() must be called with an
>     instance of class X as first argument (got instance of Y instead)

Done in CVS.

> BTW, that's the first problem I had with trying my code under 2.2.
> Well done, Guido.

You're welcome!

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list