On Fri, Apr 26, 2013 at 3:01 PM, Steven D'Aprano <[email protected]> wrote:
> On 26/04/13 13:22, Greg wrote:
>>
>> On 26/04/2013 3:12 p.m., Glenn Linderman wrote:
>>>
>>> On 4/25/2013 7:49 PM, Nick Coghlan wrote:
>>
>>
>>>> You couldn't create an enum of callables, but that would be a
>>>> seriously weird thing to do anyway....
>>>
>>>
>>> But aren't all classes callable?
>>
>>
>> An enum of classes would be seriously weird as well, I think.
>
> I don't think iscallable will work, since that descriptors like
> staticmethod and classmethod aren't callable. Nor are properties.

My point was there *are* broad categories that we can reasonably say
"you can't use these as values in an enumeration". Callables are one,
descriptors are probably another.

Alternatively, we can flip it around and require that each enum
definition nominate an expected value type (defaulting to int) and
only convert class attributes that are instances of that type to
instances of the enum class.

Either can be made to work, so it's really Guido's call as to which he
would prefer. As Barry noted, the next step is actually for someone to
create a proof of concept that shows the merge is possible in
practice, not just theory.

Cheers,
Nick.

--
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[email protected]
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