bug or feature in enum34 py2.7 backport?
Chris Angelico
rosuav at gmail.com
Wed Nov 26 10:17:59 EST 2014
More information about the Python-list mailing list
Wed Nov 26 10:17:59 EST 2014
- Previous message (by thread): bug or feature in enum34 py2.7 backport?
- Next message (by thread): Issues installing Python 2.7
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Nov 27, 2014 at 2:14 AM, Mark Summerfield <list at qtrac.plus.com> wrote: > I only mentioned it since I noticed it. I actually use Python 3 so it isn't a problem for me, but sometimes I have to teach Python 2.7 and I wanted to cover enum because it is so much nicer and easier to debug than FOO = 1 etc. > > However, the problem is that enum's function API doesn't play nicely with unicode literals. One solution is to use the class API instead: > > > from __future__ import print_function > from __future__ import unicode_literals > import enum > print(enum.version) > class A(enum.Enum): > b = 1 > c = 2 > print(A.b, A.c) Yeah, because now "class A" is not a literal, and is therefore not affected by the unicode_literals directive. But I think that notation looks just fine anyway, so that would probably be the cleanest solution. ChrisA
- Previous message (by thread): bug or feature in enum34 py2.7 backport?
- Next message (by thread): Issues installing Python 2.7
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list