removeall() in list

castironpi at gmail.com castironpi at gmail.com
Sat Jan 12 13:35:34 EST 2008


On Jan 12, 12:26 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> castiro... at gmail.com writes:
> > 2) List is referenced by others; concurrent modifications may be going
> > on; can not replace it.  Can I make asynchronous modifications and
> > merge the changes, SCM-style?
>
> Nothing else should have direct access to the list.
>
> > 3) Dictionary returns non-static order; order is important.  Create a
> > int-func tuple and sort dictionary results?  Perhaps.  That's sounding
> > pretty good.
>
> If the list is not too long, that is reasonable.  If it -is- long, the
> remove operations can be slow, but that's ok if there's not too many.
> If the list is long -and- there's a lot of adds/removes, maybe you
> want something like an AVL tree.

But items[ item ]= index is the best I can do in Python.



More information about the Python-list mailing list