clash of the methods (was Re: Why no number methods?)

James_Althoff at i2.com James_Althoff at i2.com
Tue May 15 18:50:37 EDT 2001


Michael writes:
>Well, assume that we have magically healed the type/class split so
>that all objects behave like instances.  Then imagine:
>
>class C:
>    def __repr__(self):
>        return "bongle"
>
>What's C.__repr__?  Quick!

A big problem since we want a __repr__ method for instances of C *and* a
__repr__ method for the class object C -- and these can be confused (or
collide) in C.__dict__.

Jim






More information about the Python-list mailing list