On Fri, Feb 18, 2005 at 04:52:46PM -0800, John Machin wrote:
> > > needs "if rev[first] == rev[second]: continue" here
> >
> > an 'is' is enough, and better.
> 
> Good point. You're redeeming yourself :-)

this, together with you saying that it is hard to explain, makes me
think that you aren't comfortable thinking of lists as mutable
objects.


> > what is magic about it? is it really that horrible?
> 
> Try explaining to the newbies over on the tutor list how despite "res"
> only ever *explicitly* having little bits like [3, 4] appended to it,
> it (or more properly the thing to which it refers) is actually
> festering and growing and being mutated under the surface until at the
> finale it bursts out dripping slime just like the creature from the
> black lagoon ...

understanding why that works, and why it is 'is' and not '==', are
both part of the same thing. Lists are mutable, and you can mutate
them, and they mutate. Unless you actually write code that uses the
fact you will forget it, and it will bite you. Of course, don't use it
just for the heck of it, but that creature you dismiss as a
slime-dripping mutation is actually quite useful.

While I'm at being unpolite, do you really think this code was harder
to understand than the code posted by anton, using numarray?

And, of course, if this code were for anything non-throw-awayable,
there would've been quite a bit of explaining going on between those
lines of code.

Ok, now back to being polite :)

-- 
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Hay más días que longanizas. 

Attachment: signature.asc
Description: Digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to