representation of unbound methods - strange behaviour

Skip Montanaro skip at mojam.com
Wed Aug 18 13:09:52 EDT 1999


>>>>> "Stefan" == Stefan Franke <spamfranke at bigfoot.de> writes:

    Stefan> Why does this happen:

    ...

    <unbound method A.f> stuff snipped

I believe it is constructing the method name on-the-fly using the names it
finds in the class and function.  It's not using the attribute name.

    >>> class A: pass
    ... 
    >>> def foo(): pass
    ... 
    >>> A.f = foo
    >>> A.g = foo
    >>> A.f
    <unbound method A.foo>
    >>> A.g
    <unbound method A.foo>

Skip Montanaro	| http://www.mojam.com/
skip at mojam.com  | http://www.musi-cal.com/~skip/
847-971-7098




More information about the Python-list mailing list