Bugs item #1730401, was opened at 2007-06-03 15:04 Message generated for change (Comment added) made by bcannon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730401&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.5 >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: L. Peter Deutsch (lpd) Assigned to: Nobody/Anonymous (nobody) Summary: __cmp__ present in type but not instance?? Initial Comment: hasattr(list, '__cmp__') is True, but hasattr([], '__cmp__') is False. Doesn't the Python story about instances and classes forbid this!? ---------------------------------------------------------------------- >Comment By: Brett Cannon (bcannon) Date: 2007-06-03 15:51 Message: Logged In: YES user_id=357491 Originator: NO Do a dir() on list and on [] and you will notice that __cmp__ doesn't show up. The __cmp__ you are seeing is the type instance method of list as received from being a subclass of 'type'. It's more obvious if you print out list.__cmp__ and type.__cmp__. So it does make sense when viewed from the point-of-view of metaclasses; list is an instance of type and you are seeing a metaclass instance method on list. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730401&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
