[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
Greg
greg.ewing at canterbury.ac.nz
Fri Apr 26 05:08:13 CEST 2013
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
More information about the Python-Dev
mailing list