On Sun, Nov 2, 2008 at 13:32, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Use a list comprehension:
> somelist = [ x+1 for x in somelist ]

Got it.

> Note that this creates a new list, replacing the one that was in
> somelist. If you need to actually modify somelist in place (rare) then
> use somelist[:] =  [ x+1 for x in somelist ]
>
> which creates a new list, then replaces the *contents* of somelist
> with the contents of the new list.

In what (rare) situation would you use this?

> http://personalpages.tds.net/~kent37/kk/00012.html

This page helped. Especially the link to the 'Reset your brain'
article is very interesting.

Thanks
Sander
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to