Hello, On Mon, 28 Apr 2014 13:13:53 +1000 Chris Angelico <ros...@gmail.com> wrote:
> On Mon, Apr 28, 2014 at 12:59 PM, Paul Sokolovsky <pmis...@gmail.com> > wrote: > > From the output, "User" class as expected does not override > > list.append(), but does override list.__str__(). Is this behavior > > documented somewhere (complete arrangement)? What's the rationale > > behind it? > > In Python 3.4 (don't know about other versions), list.__str__ doesn't > exist; when you call str([1,2,3]) it calls object.__str__. The MRO for > C is (C, list, User, object) so anything from list (eg append) takes > precedence over anything from User, but anything list doesn't have > will fall through to User before catching object. Thanks for quick response! I see that list.__repr__ exists, and test using it works "as expected". Hopefully, such stuff can be treated as implementation-specific details... > > ChrisA -- Best regards, Paul mailto:pmis...@gmail.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com