On 07/10/2012 18:46, Arnej Duranovic wrote:
When I type this in the python idle shell ( version 3...) :
             '0' <= '10' <= '9'
The interpreter evaluates this as true, WHY? 10 is greater than 0 but not 9
Notice I am not using the actual numbers, they are strings...I thought that
numbers being string were ordered by their numerical value but obviously
they are
not? Can anyone explain this to me and explain how strings with numbers in
them are ordered?

You thought wrong :) A string is a string is a string. They might look like numbers here but that's completely irrelevant. They'll be compared lexicographically, something I'm not inclined to attempt to explain so see here http://en.wikipedia.org/wiki/Lexicographical_order

Please also be careful with your terminology. Note that I've used compared. Ordered is very different, e.g. FIFO is often used for first in, first out.


Thx in advance.



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



--
Cheers.

Mark Lawrence.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to