list.remove for Novices

Arthur Siegel ajs at
Tue Nov 27 02:53:30 CET 2001

Steves comments on my post:

>> But the Reference Manual is for the Legal profession. I'd suggest a
> > tutorial warning.

>Along the lines of "Sitting on the branch you are sawing off the tree is
>a good idea"?

But you need to understand that for someone like myself, Python is almost
my only point of reference.  If I read about immutable and mutable, it was
hint, but actually *meant* little.  That is documentation for folks who are
in the
game, not entering it.

And even understanding the behavior now, its hard for me not to
consider it a wart. I *don't* want the language to baby-sit
me - but ...

Well maybe I can't have all ways.

>Art, surely you've been using Python long enough to realize that assignment
>never creates copies?

Again, if you are starting out with a reference point understanding that
there are assignments which behave such and so, and copies
which behave such and so, then understanding which '=' creates is
easy.  But do realize that a beginner does not come to the table
with that understanding - which is why I sometimes feel that in this
one important respect Python is not for beginners. But again - Python is
my only real point of reference  - so I can't say the concepts would get
across better using some other language.

>Isn't Python FUN?


>> The
>>for p in x:
>>    x.remove(p)
>> surprise just being a new dessert topping.

>>>Surprise? There you go, sawing away at that branch again. I realize I
>>>convince you, because you've been bitten, that this isn't a situation
>>>further documentation is necessary. Seems obvious to me, but clearly I'm
>>>typical of *all* users (thank heavens).

But the only thing I truly try to bring to the Python table is a
vocal novice voice. Not ashamed to be dumb, because I am getting smarter
all the time.

So I can promise you it is not obvious for the folks like
myself - until *after* one gets bit.

The x.remove(dup) behavior on iteration never occurred
to me. And I *did* know that, for example,
that list.reverse() was in place.

>> Is anyone aware of a reference where these issues are given
>> focus and covered clearly and comprehensively
> >for the Python novice??
>> Not that someone like me is likely to read it carefully.  Just
> >so much damage one can do screwing up a bezier curve, and
> >I tend to live dangerously - and learn by messing up enough
> >times until something eventually clicks.

>So you ADMIT that warnings wouldn't do you any good. I suppose they'd be
>useful for "other people", though?

Being a little tongue and cheek.  I constantly have used the Python
tutorial as a source.  I do have a few Python books which I also
use as reference - but I am admitting that I mostly use a trial and
error approach. The fact that Python seems so amenable to that
approach is a good part of why we get along so well.

>> My first PEP?

>I wouldn't even think about it, but of course the point of the PEPs is to
>encourage discussion.

How about this one.  A copy operator -  <=> or something.  So now
all the world is on notice from day one = is different that <=>.
Which do you mean?

Its a stupendous idea.

I am sure all agree.

Its OK, I'm getting used to ducking.


More information about the Python-list mailing list