Re: basic questions on cmp, and sort

2006-10-26 Thread Fredrik Lundh
Schüle Daniel wrote: first question In [117]: cmp(ABC,['A','B','C']) Out[117]: 1 against what part of the list is the string ABC compared? http://docs.python.org/lib/comparisons.html Objects of different types, except different numeric types and different string types,

Re: basic questions on cmp, and sort

2006-10-26 Thread Hendrik van Rooyen
Ben Finney [EMAIL PROTECTED] wrote: To: python-list@python.org Sent: Thursday, October 26, 2006 4:44 AM Subject: Re: basic questions on cmp, and sort Schüle Daniel [EMAIL PROTECTED] writes: 8--- third question sort([[1,2,3],[ABC],['Z','A'], X(), 4

basic questions on cmp, and sort

2006-10-25 Thread Schüle Daniel
Hello, first question In [117]: cmp(ABC,['A','B','C']) Out[117]: 1 against what part of the list is the string ABC compared? second question In [119]: class X(object): .: pass .: In [120]: X() X() Out[120]: True In [121]: X() X() Out[121]: False In [122]: X() X()

Re: basic questions on cmp, and sort

2006-10-25 Thread Ben Finney
Schüle Daniel [EMAIL PROTECTED] writes: Hello, first question In [117]: cmp(ABC,['A','B','C']) Out[117]: 1 against what part of the list is the string ABC compared? Why part? There are two objects; they are compared to each other. How this comparison is implemented is a matter handled

Re: basic questions on cmp, and sort

2006-10-25 Thread Martin v. Löwis
Schüle Daniel schrieb: first question In [117]: cmp(ABC,['A','B','C']) Out[117]: 1 against what part of the list is the string ABC compared? The names of the types are compared: py cmp(string, list) 1 second question In [119]: class X(object): .: pass .: In