[Numpy-discussion] draft enum NEP

Bryan Van de Ven bryanv at continuum.io
Fri Mar 16 12:26:01 EDT 2012


Hi all,

I have spent some time thinking about things, and discussing them with 
folks nearby. I actually got to wondering whether we really need new 
dtypes for this. It seems like enumerated values or factor levels could 
be cast as an annotation or metadata that could be attached to any 
existing integral dtypes. It spells differently enough that I have put 
up an alternate version that reflects this notion. I'd like to see what 
folks think of this direction:

     https://github.com/bryevdv/numpy/blob/enum/doc/neps/enum_alt.rst

So this would require adding machinery to existing dtypes to behave 
properly when there is factor metadata present. Perhaps that is not an 
acceptable trade-off, but it seems worth discussing.

I think a very similar approach could be used to add categorical ranges 
to any numerical or string types (I think they are called "shingles" in R?)

Please let me know what you think.

Bryan




More information about the NumPy-Discussion mailing list