On Sat, Apr 6, 2019 at 4:11 AM Steve Barnes <gadgetst...@live.co.uk> wrote:

> > ipython
>
> Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit
> (AMD64)]
>
> Type 'copyright', 'credits' or 'license' for more information
>
> IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
>
>
>
> In [1]: [[False]*2]*5
>
> Out[1]:
>
> [[False, False],
>
> [False, False],
>
> [False, False],
>
> [False, False],
>
> [False, False]]
>
> # Looks like exactly what was wanted
>

[ins] In [1]: x = [[False]*2]*5


[ins] In [2]: x

Out[2]:
[[False, False],
 [False, False],
 [False, False],
 [False, False],
 [False, False]]

[ins] In [3]: x[1][1] = True


[ins] In [4]: x

Out[4]: [[False, True], [False, True], [False, True], [False, True],
[False, True]]

-- 
Juancarlo *Añez*
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to