[Numpy-discussion] draft enum NEP

Mark Wiebe mwwiebe@gmail....
Tue Mar 13 20:44:39 CDT 2012


On Fri, Mar 9, 2012 at 8:55 AM, Bryan Van de Ven <bryanv@continuum.io>wrote:

> Hi all,
>
> I have started working on a NEP for adding an enumerated type to NumPy.
> It is on my GitHub:
>
>     https://github.com/bryevdv/numpy/blob/enum/doc/neps/enum.rst
>
> It is still very rough, and incomplete in places. But I would like to
> get feedback sooner rather than later in order to refine it. In
> particular there are a few questions inline in the document that I would
> like input on. Any comments, suggestions, questions, concerns, etc. are
> very welcome.
>

This looks like a great start to me.

I think the open/closed enum distinction will need to be explored a little
bit more, because it interacts with dtype immutability/hashability. Do you
know if there are any examples of Python objects in the wild that
dynamically convert from not being hashable (i.e. raising an exception if
used as a dict key) to become hashable?

It might be worth adding a section which briefly compares and contrasts the
proposed functionality with enums in various programming languages. Here
are two links I found to try and get an idea:

MS on C# enum usage:
http://msdn.microsoft.com/en-us/library/cc138362.aspx
Wikipedia on C++ enum class:
http://en.wikipedia.org/wiki/C%2B%2B11#Strongly_typed_enumerations

For example, the C# enum has a way to enable a "flags" mode, which will
create successive powers of 2. This may not be a feature NumPy needs, but
if people are finding it useful in C#, maybe it would be useful here too.

Cheers,
Mark



>
> Thanks,
>
> Bryan
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120313/b68c73cc/attachment.html 


More information about the NumPy-Discussion mailing list