trafaret_forked icon indicating copy to clipboard operation
trafaret_forked copied to clipboard

trafaret/Enum: support Python >=3.4 `enum` module

Open spumer opened this issue 8 years ago • 2 comments

Fix #60 PR

Except filling rule is different. Fill from enum keys. Cause by default enum lib support getting by key, not by value.

class MyEnum(enum.Enum):
     me = 'developer'

>>> MyEnum['me']
<MyEnum.me: 'developer'>

I think it's more clear and straightforward

spumer avatar Jun 20 '17 14:06 spumer

@Deepwalker what do you think?

spumer avatar Jun 23 '17 07:06 spumer

Not sure about your keys not values approach. What do you want to check after all? And path of trafaret is not to create big bloated classes that can work with anything. Can we create special trafaret that works with Enum classes? There is no need to this magic when you create trafaret. You know exactly what you want to check, so dont be oversmart, let people just say that they want to check Enum class, not a bunch of strings. This is how I see it.

Deepwalker avatar Jun 23 '17 09:06 Deepwalker