This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients
Date 2002-03-28.15:33:13
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=6380

I'm 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
style to override a system operation on the instance rather
than on
the class.  If you want to be able to override behavior per
instance,
use this:

  class A(object):
    def __repr__(self):
      return self.repr()
    def repr(self):
      return 'abc'

  a = A()
  a.repr = lambda: '123'
  assert repr(a) == a.__repr__() == '123'
History
Date User Action Args
2007-08-23 13:59:10adminlinkissue515336 messages
2007-08-23 13:59:10admincreate