container stuff

bearophile bearophileHUGS at lycos.com
Thu May 27 08:04:33 PDT 2010


Don:
> Yes, but if I understand correctly, the only reason to have removeAny 
> _as a primitive_ is for speed. And iterating over the container followed 
> by a single removal is almost always going to be much faster.

Most things in Python are designed to be handy first, and fast later. So I doubt performance has has any significance in this small piece of Python design.

In both Python and D is pop() is useful because it allows your collection to represent coherently its decreased or increased number of items at all times (Andrei ha shown an example where you have to add and remove items continuously).

Bye,
bearophile


More information about the Digitalmars-d mailing list