[Python-ideas] Python list of list matrixes without NumPy
Juancarlo Añez
apalala at gmail.com
Sat Apr 6 15:49:58 EDT 2019
On Sat, Apr 6, 2019 at 4:11 AM Steve Barnes <gadgetsteve at 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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190406/64c3e6a5/attachment.html>
More information about the Python-ideas
mailing list