boolean true and false values.
Tim Rowe
digitig at cix.co.uk
Mon Jun 26 17:10:00 EDT 2000
In article <8j7n6h01tnl at news2.newsguy.com>, alex at magenta.com (Alex
Martelli) wrote:
> 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...
Oh well, at least I had the right idea!
More information about the Python-list
mailing list