[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library (original) (raw)
R. David Murray rdmurray at bitdance.com
Tue Apr 23 17:56:16 CEST 2013
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 23 Apr 2013 08:44:21 -0700, Guido van Rossum <guido at python.org> wrote:
On Tue, Apr 23, 2013 at 8:31 AM, R. David Murray <rdmurray at bitdance.com> wrote: > On Tue, 23 Apr 2013 08:11:06 -0700, Guido van Rossum <guido at python.org> wrote: >> I gotta say, I'm with Antoine here. It's pretty natural (also coming >> from other languages) to assume that the class used to define the >> enums is also the type of the enum values. Certainly this is how it >> works in Java and C++, and I would say it's the same in Pascal and >> probably most other languages. > > Well, I guess I can wrap my head around it :) An Enum is an odd duck > anyway, which I suppose is one of the things that makes it worth adding.
Sorry, you're being to literary/poetic. I can't tell what you meant by this response.
I was alluding to the fact that in Python we usually work with instances of classes (not always, I know, but still...), but with Enum we are really using the class as a first level object. Given that, breaking my (questionable?) intuition about isinstance should not be unexpected. And by that last phrase I meant to refer to the fact that getting this right is obviously non-trivial, which is one of the things that makes it worth adding as a Python feature.
--David
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]