[New-bugs-announce] [issue12951] List behavior is different
शंतनू
report at bugs.python.org
Fri Sep 9 21:29:04 CEST 2011
New submission from शंतनू <shantanoo at gmail.com>:
URL: http://docs.python.org/library/stdtypes.html
Following example is given.
>>> lists = [[]] * 3
>>> lists
[[], [], []]
>>> lists[0].append(3)
>>> lists
[[3], [3], [3]]
Behavior is as follows.
>>> a = [[]] * 3
>>> a
[[], [], []]
>>> a[0] = 1
>>> a
[1, [], []]
>>>
Python interpreter details:
$ python
Python 2.7.2 (default, Aug 22 2011, 13:53:27)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
----------
assignee: docs at python
components: Documentation
messages: 143793
nosy: docs at python, शंतनू
priority: normal
severity: normal
status: open
title: List behavior is different
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12951>
_______________________________________
More information about the New-bugs-announce
mailing list