[Numpy-discussion] a list of all available integer dtypes
Robert Kern
robert.kern at gmail.com
Fri Aug 9 18:17:27 EDT 2013
On Fri, Aug 9, 2013 at 11:06 PM, Valentin Haenel <valentin at haenel.co> wrote:
>
> Hi,
>
> I have a quick question: Is there a way to get a list of all available
> Numpy integer dtypes programatically?
[~]
|8> def all_dtypes(cls):
..> for sub in cls.__subclasses__():
..> try:
..> sub(0)
..> except TypeError:
..> pass
..> else:
..> yield sub
..> for subsub in all_dtypes(sub):
..> yield subsub
..>
[~]
|10> list(all_dtypes(np.integer))
[numpy.int8,
numpy.int16,
numpy.int32,
numpy.int64,
numpy.int64,
numpy.timedelta64,
numpy.uint8,
numpy.uint16,
numpy.uint32,
numpy.uint64,
numpy.uint64]
--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130809/26dc7ab0/attachment.html>
More information about the NumPy-Discussion
mailing list