list.remove for Novices

Peter Hansen peter at
Sun Nov 25 23:12:03 CET 2001

Arthur Siegel wrote:
> >>>foo = [1, 2, 3, 4, 5]
> >>>for bar in foo:
> ...        foo.remove(bar)
> But damn it to hell. Even when I try to be a normal Python
> guy, and just post up "technical" problems, I get into-
> or raise - issues/controversary.
> Because I am being asked to accept that the list.remove
> behavior is somehow apparent - rather than a true
> trap for the novice.  

I would say that *is* a trap for the novice, but for
any *programming* novice, not just a Python novice.  

That type of thing can happen in almost any environment,
and I suspect any defensiveness about it is because it
could sound like an unfair attack on Python specifically.

That said, if it's not in the Python FAQ it I think it 
should be.  (And a quick search suggests it's not.)

Peter Hansen, P.Eng.
peter at

More information about the Python-list mailing list