A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-April/125584.html below:

[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard libraryGreg 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4