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
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