[Numpy-discussion] array of random numbers fails to construct

Elliot Hallmark Permafacture at gmail.com
Mon Dec 7 18:03:10 EST 2015


David,

>I'm concluding that the .astype(np.uint8) is applied after the array is
constructed, instead of during the process.

That is how python works in general.  astype is a method of an array, so
randint needs to return the array before there is something with an astype
method to call.  A dtype keyword arg to randint, on the otherhand, would
influence the construction of the array.

Elliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151207/e04f58e8/attachment.html>


More information about the NumPy-Discussion mailing list