Bugs item #1275719, was opened at 2005-08-29 16:54 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1275719&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.4 Status: Open Resolution: None Priority: 5 Submitted By: Antoine Pitrou (pitrou) Assigned to: Nobody/Anonymous (nobody) Summary: discrepancy between str.__cmp__ and unicode.__cmp__ Initial Comment: I had the surprise, while wanted to use str.__cmp__ as the cmp argument to list.sort(), that it seems buggy compared to unicode.__cmp__, and that these methods seem implemented quite differently (they have a different type): $ python Python 2.4.1 (#2, Aug 25 2005, 18:20:57) [GCC 4.0.1 (4.0.1-2mdk for Mandriva Linux release 2006.0)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> unicode.__cmp__ <slot wrapper '__cmp__' of 'unicode' objects> >>> str.__cmp__ <method-wrapper object at 0xb7a164ac> >>> u'a'.__cmp__(u'b') -1 >>> 'a'.__cmp__('b') Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'str' object has no attribute '__cmp__' >>> unicode.__cmp__(u'a', u'b') -1 >>> str.__cmp__('a', 'b') Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: expected 1 arguments, got 2 Am I missing something ? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1275719&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com