-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
not sure how this would look, but I can see people that already use enums for "status handling" (or similar stuff) wanting the features status map provides.
we might tackle this with a enum-like interface:
from status_map.enum import StatusEnum # this should be compatible with std lib's enum.Enum
class TaskEnum(StatusEnum):
TODO = 0 # there might be a better way to do this in the std lib
DOING = 1
DONE = 2The issue here is: how do we handle the transitions having an interface like that?
We might appeal to a django-like Meta class (I'm not really a fan of it though):
class TaskEnum(StatusEnum):
TODO = 0
DOING = 1
DONE = 2
class Meta:
transitions = {'TODO': ['DOING'], 'DOING': ['TODO', 'DONE'], 'DONE': []}Another possibility is to bet on a more of a "freestyle" method:
class TaskEnum(StatusEnum):
TODO = 0, 'task waiting for someone work on it', ['DOING']
DOING = 1, 'task in progess', ['TODO', 'DONE"]
DONE = 2, 'task ready!', [] # adding the possibility to the user describe what each status meansIt's not very intuitive but at the same time not complicated. With this approach I think we save a lot of code and can even add some meaning to all this. And it's not too difficult to implement if we use the aenum [1] lib.
Those two were the best alternatives I could think of, but there might be better ideas.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels