Skip to content

Commit

Permalink
Restore py33-compatibility
Browse files Browse the repository at this point in the history
Don't use Enum, but use a hacky close-enough replacement.
  • Loading branch information
Hugo Osvaldo Barrera committed Apr 12, 2016
1 parent b44a7a9 commit 76f279b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions todoman/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import parsedatetime
import urwid
from dateutil.tz import tzlocal
from enum import Enum


class EditState(Enum):
none = 1
saved = 2
deleted = 3
class EditState:
none = object()
saved = object()
deleted = object()


class TodoEditor:
Expand Down

5 comments on commit 76f279b

@untitaker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use enum34 from PyPI.

@WhyNotHugo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny hack vs another dependency. I'm not sure which one I prefer.

@nim65s
Copy link
Contributor

@nim65s nim65s commented on 76f279b Oct 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about using a conditional dependency (':python_version=="3.3"': ['enum34'],) ? :)

@WhyNotHugo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this is simpler. What are the advantages of using Enum instead of this?

@nim65s
Copy link
Contributor

@nim65s nim65s commented on 76f279b Oct 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be one-- and preferably only one --obvious way to do it.

imho, using the standard lib is usually an "obvious way to do it"…
But this is not an advantage ^^"
In fact I just don't understand why you replaced 1, 2 & 3 by object(), but it doesn't matter x)

Please sign in to comment.