[Python-Dev] repr(x) != x.__repr__()
Guido van Rossum
guido@python.org
Thu, 28 Mar 2002 11:28:05 -0500
> On Thu, Mar 28, 2002 at 10:28:12AM -0500, Guido van Rossum wrote:
> > I'm probably going to reject this bug as "won't fix". I specifically
> > put code in the new classes to create this behavior. It's partly a
> > performance hack: many operations become much slower if they have to
> > check the instance __dict__ first. But I also believe it's poor
>
> If this is by design it's ok. I suspected it might be an accidental result
> of the different internal structure of new style classes.
Yes, I thought about it long and hard and decided that it should be a
feature.
> > check the instance __dict__ first. But I also believe it's poor
> > style to override a system operation on the instance rather than on
> > the class.
>
> And if it's not a system operation? Is method assignment in general
> considered poor style?
That's up to the application.
> Something as vile and unspeakable as changing an
> object's __class__ at runtime? ;-)
I don't know what you're talking about. :-)
--Guido van Rossum (home page: http://www.python.org/~guido/)