[Python-Dev] enum discussion: can someone please summarize open issues? (original) (raw)
Steven D'Aprano steve at pearwood.info
Mon Apr 29 01:37:44 CEST 2013
- Previous message: [Python-Dev] enum discussion: can someone please summarize open issues?
- Next message: [Python-Dev] enum discussion: can someone please summarize open issues?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 29/04/13 06:02, Guido van Rossum wrote:
My opinions added
On Sun, Apr 28, 2013 at 12:32 PM, Ethan Furman <ethan at 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 daysinyear 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 avgtemp 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
- Previous message: [Python-Dev] enum discussion: can someone please summarize open issues?
- Next message: [Python-Dev] enum discussion: can someone please summarize open issues?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]