boolean true and false values.

Alex Martelli alex at magenta.com
Mon Jun 26 09:26:11 EDT 2000


Tim Rowe <digitig at cix.co.uk> wrote in message
news:memo.20000625230712.5257C at digitig.compulink.co.uk...
    [snip]
> > Yes, I know, but why is it not in the language ?
> > Quite a lot of algorithms rely on having sets. If you put them in a
> > list, there
> > is an order which is not always wanted.
>
> There is always an order, but you don't always know what it is. When you
> write your set class you just document that if the user iterates over the
> elements then the order in which they will be returned is undefined --
> that's what happens in the C++ STL. The fact that the implementation has a

Good general concept, un-good specific example.  C++'s std::set (originally
inspired from STL) is based on an ordering relationship, and when you
iterate
from .begin() to .end() you get the elements in increasing order according
to
just that relationship.  The current release of STL also has hash-based
containers (which didn't make it into the C++ standard library), but the
standard ones are sorted...


Alex







More information about the Python-list mailing list