[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Guido van Rossum
guido at python.org
Fri Apr 26 00:19:48 CEST 2013
On Thu, Apr 25, 2013 at 3:02 PM, Barry Warsaw <barry at python.org> wrote:
> On Apr 25, 2013, at 02:54 PM, Guido van Rossum wrote:
>>I don't know what's going on,
> Mostly that this is my first opportunity to chime in on the subject.
>>but it feels like we had this same discussion a week ago, and I still
>>disagree. Disregarding, the C[i] notation, I feel quite strongly that in the
>> red = 1
>> white = 2
>> blue = 3
>> orange = 4
>>the values Color.red etc. should be instances of Color. This is how
>>things work in all other languages that I am aware of that let you
> Is it enough that isinstance(Color.red, Color) returns True, or do you
> really-and-truly want them to be instances of Color?
> I still think it's weird, but I could accept the former if you're flexible on
> the latter, which in some sense is just an implementation detail anyway.
Clearly this is a trick question. :-)
I was told when this was brought up previously (a week ago?) that it
would be simple to make it truly the same class.
I suppose you were going to propose to use isinstance() overloading,
but I honestly think that Color.red.__class__ should be the same
object as Color.
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev