Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81570

Re: bug or feature in enum34 py2.7 backport?

References <1b49aa55-ba5f-4e70-8ddb-ae5dea3a40da@googlegroups.com> <1417010748.2940071.195658861.2859C26B@webmail.messagingengine.com>
Date 2014-11-27 01:40 +1100
Subject Re: bug or feature in enum34 py2.7 backport?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.16324.1417012836.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Nov 27, 2014 at 1:05 AM,  <random832@fastmail.us> wrote:
> On Wed, Nov 26, 2014, at 06:29, Mark Summerfield wrote:
>> TypeError: type() argument 1 must be string, not unicode
>
> If this is a bug, maybe it is one in type() itself - I get the same
> error with type('X', (object,), dict(a=1))

I'd say that's a limitation, not a bug. A lot of stuff in Python 2
depends on identifiers being ASCII-only byte strings, including -
apparently - parts of the core code. Suggestion: Switch to Python 3,
or if you can't do that, pass your identifiers through str(). When you
do eventually switch to Py3, that won't do anything, but in Py2, it'll
force them to be byte strings. As long as they are actually
ASCII-only, that'll solve your problem.

ChrisA

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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