26.04.13 05:13, Nick Coghlan написав(ла):
With a merged design, it becomes *really* hard to give the instances custom behaviour, because the metaclass will somehow have to differentiate between namespace entries that are intended to be callables, and those which are intended to be instances of the enum. This is not an easy problem to solve.
What if use mixins? Shouldn't it work without magic? class ColorMethods: def wave(self, n=1): for _ in range(n): print('Waving', self) class Color(ColorMethods, Enum): red = 1 white = 2 blue = 3 orange = 4 _______________________________________________ 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