On 29/04/13 06:02, Guido van Rossum wrote:
My opinions added

On Sun, Apr 28, 2013 at 12:32 PM, Ethan Furman <et...@stoneleaf.us> wrote:


Definite Issues:

   - should enum items be of the type of the Enum class? (i.e. type(SPRING)
is Seasons)

IMO Yes.

+1


   - should an enum item be selectable via __call__ instead of __getitem__
(i.e. Seasons(3) is AUTUMN)

No opinion.

Does anyone know why this is even an issue? Is this pure bike-shedding over the 
API, or are there
technical reasons for choosing one over the other?


   - should days_in_year be enumerated?

Yes. (If you don't want it to be, and it's not a method/descriptor,
move it out of the class.)

+1, but see below.


   - should avg_temp be enumerated?

IMO No.

   - for the above two, how should they be included/excluded?

IMO Everything should be enumerated except
(a) things with a __get__() method (i.e. descriptors)
(b) __dunder__ names

+1 on excluding dunder names. +0 on excluding things with __get__.

I have also suggested that that the enum package provide a decorator
which can be used to explicitly flag values to *not* be turned into
enum values. See here:

http://mail.python.org/pipermail/python-dev/2013-April/125641.html

Even if the Enum class doesn't support this feature, I ask that it be
written in such a way that a subclass could add it (i.e. please expose
a public method for deciding what to exclude).




--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to