[Tutor] string rules for 'number'

Steven D'Aprano steve at pearwood.info
Mon Oct 8 00:56:35 CEST 2012


On 08/10/12 05:20, Mark Lawrence wrote:

[...]
> 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.

Actually ordered is perfectly fine in this context. Notice that the
page you link to is called lexicographical ORDER.

"Compared" is a verb and refers to the act of examining the items in
some sense. There are many different comparisons in Python: < > <=
>= == != `is` `is not`.

Ordered can mean one of two things:

- that the items in question are *capable* of being placed into some
   order e.g. numbers can be ordered by value; complex numbers cannot;

- that the items in question actually *have been* ordered.

"Some order" includes: numeric order, date order, lexicographical
order, insertion order, even random order!


You may be conflating this with the difference between "ordered
dict" and "sorted dict", where the order referred to in the first
case is insertion order rather than sorted order.


-- 
Steven


More information about the Tutor mailing list