'1' + 1 ==> True ???
Nicola Mingotti
bla at libero.it
Thu Mar 18 00:15:44 EST 2004
On Wed, 17 Mar 2004 19:22:26 -0800, Erik Max Francis wrote:
>> ------
>> >>> '1' > 1
>> True
>> ------
> Yes, with the exception of complex numbers, doing comparisons between
> objects of different types is valid. The ordering is guaranteed to be
> consistent on a particular implementation (e.g., here strings are
> considered greater than ints). ...
This is all what i wanted to know .
Even if i can't see it's utility , at least
for the behaviour of the comparison between strings
and numbers with every string considered greater of every int .
>> -----------------------------
>> >>>'1'.__gt__.__doc__
>> 'x.__gt__(y) <==> x>y'
>> -----------------------------
>
> I don't understand what bearing this snippet has on the previous two.
Here i was looking for what you told me , so something like :
x.__gt__(y) <==> x>y if x and y are numeric object ,
every string is greater than every number (ErrorObject ,
user define class ... ??) ...
... may be one day i could add it myself ... ;)
Thank you very much for you help .
Bye .
More information about the Python-list
mailing list