initialising a list of lists

Fredrik Lundh fredrik at pythonware.com
Wed Nov 16 11:27:43 EST 2005


Peter Kleiweg wrote:

>> http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
>
> In other words: no there isn't.

For people who actually knows Python, a list comprehension is clear and
obviously correct.

For people who actually knows Python, your first solution is also obviously
wrong.  To create a new list objects, you have to execute the list display.
New objects never appear out of the blue, and Python hardly ever copies
objects unless you tell it to do so.

</F> 






More information about the Python-list mailing list