On Oct 17, 5:40 pm, Paul Hankin <[EMAIL PROTECTED]> wrote:
> To answer your question though: a += b is *not* the same as a = a + b.
> The latter would create a new list and assign it to a, whereas a += b
> updates a in-place.

I know I'm being a little finicky here, but how would someone know
that a+=b is not the same as a=a+b?
Any documentation or reference that mentions this?


> Use a += b rather than a.extend(b): I'm not sure what I was thinking.
> Anyway, look at 'timeit' to see how to measure things like this, but
> my advice would be not to worry and to write the most readable code -
> and only optimise if your code's runnign too slowly.

I understand. Thanks :)
At the same time, however, as someone new learning the language, I
feel it always helps to know what the best practices and patterns are
at the very outset (at least for someone who chooses to become a good
programmer in that language). I mean, for me it's like this, I just
don't want to get the work done, I would really want to know why I do
something a certain way and not some other way :)

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

Reply via email to