array constructor

Tom Holroyd tomh at po.crl.go.jp
Mon Feb 28 05:46:14 EST 2000


On Mon, 28 Feb 2000, Fredrik Lundh wrote:

> Tom Holroyd <tomh at po.crl.go.jp> wrote:
> > m = [[0]*4]*4 doesn't work:
> 
> http://www.python.org/doc/FAQ.html#4.50

Yea, and I read that once, too.  That's how
I knew why it didn't work.  I just wondered
if there was some other idiom than the one
I mentioned, which is the *same one* that's
in the FAQ...

Eh;

>>> from Numeric import *
>>> m = zeros((4, 4), PyObject)

I'll have my cake and eat it too, thanks.

Dr. Tom





More information about the Python-list mailing list