[Python-Dev] Enum: subclassing? (original) (raw)
Barry Warsaw barry at python.org
Thu May 2 17:23:56 CEST 2013
- Previous message: [Python-Dev] Enum: subclassing?
- Next message: [Python-Dev] Enum: subclassing?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On May 01, 2013, at 08:47 PM, Georg Brandl wrote:
Wait a moment... it might not be immediately useful for IntEnums (however, that's because base Enum currently defines int which I find questionable),
And broken. And unnecessary. :)
class Foo(Enum): ... a = 'a' ... b = 'b' ... int(Foo.a) Traceback (most recent call last): File "", line 1, in TypeError: int returned non-int (type str)
...remove Enum.int()...
class Bar(int, Enum): ... a = 1 ... b = 2 ... int(Bar.a) 1
So yes, Enum.int() should be removed.
-Barry
- Previous message: [Python-Dev] Enum: subclassing?
- Next message: [Python-Dev] Enum: subclassing?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]