Python Written in C?
mk
mrkafk at gmail.com
Wed Jul 23 08:10:22 EDT 2008
Marc 'BlackJack' Rintsch wrote:
> An operation that most people avoid because of the penalty of "shifting
> down" all elements after the deleted one. Pythonistas tend to build new
> lists without unwanted elements instead.
Which is exactly what I have done with my big lxml.etree, from which I
needed to delete some elements: constructed a new tree only with
elements I wanted. Sure, that works.
There _is_ a minor side effect: nearly doubling memory usage while the
operation lasts. 99% of the time it's not a problem, sure.
> I can't even remember when I
> deleted something from a list in the past.
Still, doesn't that strike you as.. workaround?
I half-got used to it, but it would still be nice not to (practically)
have to use it.
Enough whining. Gonna eat my quiche and do my Python. :-)
More information about the Python-list
mailing list