Remove items from a list
Peter Otten
__peter__ at web.de
Wed Sep 8 13:44:53 EDT 2004
More information about the Python-list mailing list
Wed Sep 8 13:44:53 EDT 2004
- Previous message (by thread): Remove items from a list
- Next message (by thread): Standard graph API?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dan Perl wrote: > to forget that. Creating another list from the first one by filtering or > with a list comprehension should be the preferred solution, unless the > intention is to have this list used in more than one place and have the > changes reflected in all those places. Even then there is a less painful solution using slices: >>> a = b = [1,2,3] >>> a[:] = [2*i for i in a if i != 2] >>> a [2, 6] >>> b [2, 6] Peter
- Previous message (by thread): Remove items from a list
- Next message (by thread): Standard graph API?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list