Guido van Rossum wrote: > we'd like to be able to define methods for the enum values, and the simplest > way (for the user) to define methods for the enum values would be to allow > def statements, possibly decorated, in the class. But now the implementation > has to draw a somewhat murky line between which definitions in the class > should be interpreted as enum value definitions, and which should be > interpreted as method definitions. If we had access to the syntax used for > the definition, this would be simple: assignments define items, def > statements define methods. But at run time we only see the final object > resulting from the definition, which may not even be callable in the case of > certain decorators. I am still optimistic that we can come up with a rule > that works well enough in practice (and the Zen rule to which I was referring > was, of course, "practicality beats purity").
Maybe only names that do *not* start with underscore should be treated as enum value names; and those starting with underscore could be used e.g. to define methods etc.? Python has a long tradition of treating names differently depending of that feature. *j -- Sent from phone...
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com