Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'affected': 0.07; 'debug': 0.07; 'nicely': 0.07; 'subject:bug': 0.07; 'directive.': 0.09; 'yeah,': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7': 0.14; '__future__': 0.16; 'enum': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instead:': 0.16; 'literal,': 0.16; 'literals.': 0.16; 'notation': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'solution.': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'unicode': 0.24; 'fine': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'easier': 0.31; 'class': 0.32; 'probably': 0.32; 'noticed': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'sometimes': 0.38; 'nov': 0.38; 'skip:u 10': 0.60; 'mentioned': 0.61; 'teach': 0.65; 'therefore': 0.72; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=2sLqc7+5SXwB2OzsWIqCHkjh+oYZApQiMWoRl4gC2as=; b=jLrMUG5UJaaLwzNnNVIUxuo8isCpDZ9LRWuMtahi8qo5ZEP2h1RFrAUdESQTe/RDPY rOcwANNx5RVkCscLLVEei4dAcnLkh3oO/AhIekxK/dSj43GE+oFUuLNZrWZncP8QeRVf SQ3BwXpSpp6NJJrRXh3IEZa+4WuX3JvVu4HlkuFjdaJGon5fd9YkKC6GFzuk9C3J/gXT tLA80KRTi8PAEo8hUs8q0ZgHtfusf8wck45U2x7dhi9iq/IhIc91ZZEFnAR1StkWW0Aj Dul4LBhzl9NGdaiTHqks+2zpieRS6FTUuh5RfLsr0ls4AxNNWhDFile2U3QYMOygj/JZ 1nQA== MIME-Version: 1.0 X-Received: by 10.50.171.193 with SMTP id aw1mr23756969igc.2.1417015080003; Wed, 26 Nov 2014 07:18:00 -0800 (PST) In-Reply-To: References: <1b49aa55-ba5f-4e70-8ddb-ae5dea3a40da@googlegroups.com> <1417010748.2940071.195658861.2859C26B@webmail.messagingengine.com> Date: Thu, 27 Nov 2014 02:17:59 +1100 Subject: Re: bug or feature in enum34 py2.7 backport? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417015088 news.xs4all.nl 2961 [2001:888:2000:d::a6]:56480 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81584 On Thu, Nov 27, 2014 at 2:14 AM, Mark Summerfield 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