On 04/26/2013 08:50 AM, Larry Hastings wrote: > FWIW I'm +0.5 on "the enum metaclass ignores callables and > descriptors". This seems reasonably Pythonic, much more so than "ignore > everything except ints and strings". And as long as we're > special-casing it I think we should opt for flexibility. Certainly I see > nothing wrong with enums of float, complex, Decimal, and Fraction, so I > don't see a good place to draw the line with a whitelist. A whitelist, if we go that route, should be on a per Enum basis -- so something like: class Planets(str, Enum): PLUTO = 'it is too a planet!' MERCURY = 'definitely a planet' SATURN = 'darn big planet' solar_mass = 82738273 # or some really big number light_year = 1827499 # another really big number (of feet!) def horrorscope(self, message): return ('%s will be in retrograde... ' 'don't communicate today.' % self) and only PLUTO, MERCURY, and SATURN would be converted to enums. -- ~Ethan~
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