Collection interfaces
Topmind
topmind at technologist.com
Tue Feb 27 14:51:10 EST 2001
> "Topmind" <topmind at technologist.com> wrote in message
> news:MPG.1504d14563dce6499896af at news.earthlink.net...
> [snip]
> > The main point is that you *do* stack operations on a collection.
>
> I may be missing your point. In Standard C++, you may
> _adapt_ *some* collections for use as a stack -- that is
> what std::stack is for, it's an ADAPTER. But *NOT* all
> collections are usable as 'stacks' -- only those on which
> order of insertion is significant and recorded; what would
> it make to 'pop' the 'top' (what top?) of a multiset, say?
>
>
> Alex
>
>
Why can't the nodes of a multi-set ALSO have time-stamps
or a sequantial record/node number in them?
If so, then in T.O.P. thinking it should be
a sinch to use it as a stack also. (Even if by chance the the API
does not provide stack operations, writing a
Push and Pop function/method should be a snap.)
IOW, a "stack" or "multiset" is *how you use a
collection*, not how it is implemented or what
the original API used on it was. The HAS-A approach
to collections is just plain more flexible because
you are less locked into this-or-that thinking
and fences.
Requirements change and morph and merge.
-tmind-
More information about the Python-list
mailing list