On Apr 23, 2013, at 10:53 AM, R. David Murray wrote: >Ah. I'd be looking for a bug every time I saw isinstance(value, >myEnumClass). A better class name for values and an API for getting that >class from the EnumClass would be nice, though. (So that you could write >"isinstance(value, MyEnumClass.ValueClass)", say.) I think if we did this, the attribute should be the same name as the one used to customize the value factory. Okay, this is horrible, but you could use isinstance(value, MyEnumClass.__value_factory__) The only thing stopping you from doing this right now is that when __value_factory__ is not given, a default is used which is not available on that attribute. That's easily corrected though. 1) really, to be consistent with the documentation, this should be __item_factory__ since the attributes of the enum class are called "items", while items have an underlying value (e.g. A.b.value). 2) A better name than either __item_factory__ or __value_factory__ is welcome, though I guess that will spawn another bikeshedding, soul-destroying centi-thread. ;) 3) I'd like to make the implementation names consistent with the documentation in the next version of flufl.enum. -Barry
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