This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mmokrejs
Recipients mmokrejs
Date 2012-07-21.21:54:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342907675.08.0.583810202929.issue15416@psf.upfronthosting.co.za>
In-reply-to
Content
Hi,
  I thought that I can easily create a list of, say 3, nested lists:

$ python
Python 2.7.3 (default, May 17 2012, 21:10:41) 
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 3 * [[]]
[[], [], []]
>>> a=3 * [[]]
>>> a[0]
[]
>>> a[1].append('sdds')
>>> a
[['sdds'], ['sdds'], ['sdds']]
>>> a[0].append('xxx')
>>> a
[['sdds', 'xxx'], ['sdds', 'xxx'], ['sdds', 'xxx']]


The below works as expected.

>>> a=[[], [], []]
>>> a
[[], [], []]
>>> a[0]
[]
>>> a[1]
[]
>>> a[1].append('sdds')
>>> a[0].append('xxx')
>>> a
[['xxx'], ['sdds'], []]
>>>


Of course, I want to do like:

a = len(b) * [] # to get a list of individual hashes
c = len(b) * [0] # to get a list of indvidual counters
History
Date User Action Args
2012-07-21 21:54:35mmokrejssetrecipients: + mmokrejs
2012-07-21 21:54:35mmokrejssetmessageid: <1342907675.08.0.583810202929.issue15416@psf.upfronthosting.co.za>
2012-07-21 21:54:34mmokrejslinkissue15416 messages
2012-07-21 21:54:34mmokrejscreate