[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library (original) (raw)
Greg greg.ewing at canterbury.ac.nz
Fri Apr 26 05:08:13 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 26/04/2013 2:38 p.m., Guido van Rossum wrote:
Can't we do some kind of callable check? There may be some weird decorators that won't work, but they aren't likely to be useful in this context.
Another possible solution:
class Color:
red = 1
white = 2
blue = 3
orange = 4
class __methods__:
def wave(self, n=1):
for _ in range(n):
print('Waving', self)
and have the metaclass pull the functions out of the methods sub-object.
-- Greg
- 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 ]