Python Equivalent of Matlab's size()
Alan Daniels
daniels at mindspring.com
Tue Jun 5 22:51:04 EDT 2001
On 5 Jun 2001 14:55:40 -0700, Humanity let out a collective sigh of
relief when prem at engr.uky.edu (Prem Rachakonda) finally typed:
>What is the Python equivalent of Matlab's size() function. I need
>to find the confirm the size of an reshaped array.
To my knowledge, there isn't one currently (I take it you mean a
function to say how many bytes a particular object is taking up, I'm
not sure of what Matlab means by "size"). There's a builtin method
proposed in PEP-42 (the answer to Life, the Universe, and Everything):
http://python.sourceforge.net/peps/pep-0042.html
so you may see something like this in Python 2.2.
In the meantime, you can get the number of elements in an array with
the "len" function. Won't tell you how many bytes, though.
Hope this helps.
==============================
Alan Daniels
daniels at alandaniels dot com
More information about the Python-list
mailing list