On 03/13/2012 06:44 PM, Mark Wiebe wrote: > On Fri, Mar 9, 2012 at 8:55 AM, Bryan Van de Ven <bry...@continuum.io > <mailto:bry...@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?
In Sage, the matrix objects are mutable when constructed, and you can set_immutable to make them immutable. The way I look at that though is that it is part of the construction phase of the object, you'd typically construct, fill it in, then set_immutable (to finish construction), then use it. set/frozenset is an example of the opposite, and a design I personally like better (i.e., "frozen_dtype" :-)). Dag > > 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 <mailto:NumPy-Discussion@scipy.org> > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion