[Numpy-discussion] np.fromstring and Python 3
Thomas Robitaille
thomas.robitaille at gmail.com
Sun Jul 25 10:17:53 EDT 2010
Hi,
The following example illustrates a problem I'm encountering a problem with the np.fromstring function in Python 3:
Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> string = "".join(chr(i) for i in range(256))
>>> a = np.fromstring(string, dtype=np.int8)
>>> print(len(string))
256
>>> print(len(a))
384
The array 'a' should have the same size as 'string' since I'm using a 1-byte datatype. Is this a bug, or do I need to change the way I use this function in Python 3?
I am using Numpy r8523
Cheers,
Tom
More information about the NumPy-Discussion
mailing list