Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81584
| References | <1b49aa55-ba5f-4e70-8ddb-ae5dea3a40da@googlegroups.com> <1417010748.2940071.195658861.2859C26B@webmail.messagingengine.com> <mailman.16324.1417012836.18130.python-list@python.org> <bad44c48-3592-4c9b-ba97-a6f19e30f95d@googlegroups.com> |
|---|---|
| Date | 2014-11-27 02:17 +1100 |
| Subject | Re: bug or feature in enum34 py2.7 backport? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16333.1417015088.18130.python-list@python.org> (permalink) |
On Thu, Nov 27, 2014 at 2:14 AM, Mark Summerfield <list@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
bug or feature in enum34 py2.7 backport? Mark Summerfield <list@qtrac.plus.com> - 2014-11-26 03:29 -0800
Re: bug or feature in enum34 py2.7 backport? random832@fastmail.us - 2014-11-26 09:05 -0500
Re: bug or feature in enum34 py2.7 backport? Chris Angelico <rosuav@gmail.com> - 2014-11-27 01:40 +1100
Re: bug or feature in enum34 py2.7 backport? Mark Summerfield <list@qtrac.plus.com> - 2014-11-26 07:14 -0800
Re: bug or feature in enum34 py2.7 backport? Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:17 +1100
Re: bug or feature in enum34 py2.7 backport? random832@fastmail.us - 2014-11-26 10:32 -0500
Re: bug or feature in enum34 py2.7 backport? Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:46 +1100
Re: bug or feature in enum34 py2.7 backport? Ethan Furman <ethan@stoneleaf.us> - 2014-11-26 08:58 -0800
Re: bug or feature in enum34 py2.7 backport? Terry Reedy <tjreedy@udel.edu> - 2014-11-26 16:16 -0500
csiph-web