FEEDBACK WANTED: Type/class unification

Christian Tanzer tanzer at swing.co.at
Wed Aug 22 04:43:03 EDT 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.

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)

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

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list