tri.token compared to Enum

Ethan Furman ethan at stoneleaf.us
Sun Oct 20 12:15:20 EDT 2019


On 10/20/2019 04:16 AM, Anders Hovmöller wrote:
> On 20 Oct 2019, at 12:41, Steve Jorgensen wrote:
>> Anders Hovmöller wrote:

>>> We try to do the same thing in various libraries. We've settled on using existing
>>> python and end up with syntax like:
>>>
>>> class MyForm(Form):
>>>     field = Field()
>>>
>>> or in your case
>>>
>>> class Colors(TokenContainer):
>>>     red = Token()
>>>     green = Token()
>>>     blue = Token()
>>>
>>> (this is using tri.token).
>>
>> This seems like a good approach and is similar to the strategy Enum uses.
> 
> Site note: When we saw enums landing we hoped we could ditch tri.token but unfortunately enums have a bunch of limitations and restrictions that make them quite unusable for our more general use case :(

Out of curiosity, which limitations?

--
~Ethan~



More information about the Python-list mailing list