[Python-Dev] LinkedHashSet/LinkedHashMap equivalents
mwh at python.net
Thu Mar 10 09:42:55 CET 2005
"Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> writes:
> Set: Items are iterated over in the order that they are added. Adding an
> item that compares equal to one that is already in the set does not
> replace the item already in the set, and does not change the iteration
> order. Removing an item, then re-adding it moves the item to the end of
> the iteration order.
Well, this could be satisfied by an append_new operation on lists,
right (thinking of Common Lisps #'cl:pushnew)? Complexity not that
great, of course, but I've written code like:
if a not in l:
and not suffered that badly for it before now...
> Dict: Keys are iterated over in the order that they are added. Setting a
> value using a key that compares equal to one already in the dict
> replaces the value, but not the key, and does not change the iteration
> order. Removing a key (and value) then re-adding it moves the key to the
> end of the iteration order.
And these are what CL types call association lists, in effect.
printf( "Go buy a better computer" );
exit( ETHESKYISFALLINGANDIWANTMYMAMA );
-- Dimitri Maziuk on writing secure code, asr
More information about the Python-Dev