[Tutor] Python3 Tutorial question about a[:] = []

Richard D. Moores rdmoores at gmail.com
Wed Feb 16 18:39:36 CET 2011


from <http://docs.python.org/py3k/tutorial/introduction.html#lists> :

>>> # Clear the list: replace all items with an empty list
>>> a[:] = []
>>> a
[]

I've been using
>>> a = []
>>> a
[]

What's the difference?

Thanks,

Dick Moores


More information about the Tutor mailing list