This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Builtin ascii() function from future_builtins includes leading "u" of unicode strings
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, tav
Priority: normal Keywords:

Created on 2008-08-22 00:19 by tav, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg71708 - (view) Author: tav (tav) Date: 2008-08-22 00:19
Perhaps I misunderstood the intended behaviour of the ascii() builtin in 
the future_builtins module, but the following behaviour is unexpected:

  >>> from __future__ import unicode_literals
  >>> from future_builtins import ascii

  >>> test = 'hello'

  >>> ascii(test)
  "u'hello'"

Surely the leading 'u' should not be there?

After all, this is a future builtin we are importing -- when all 
'strings' are unicode by default?
msg71710 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-22 00:36
This is a side effect of ascii returning a python 2.x unicode object.
The repr still gives a leading "u". The point of ascii is that it
returns a unicode object with only ascii characters. See PEP 3138 for
more information.
History
Date User Action Args
2022-04-11 14:56:38adminsetgithub: 47891
2008-08-22 00:36:43benjamin.petersonsetstatus: open -> closed
resolution: wont fix
messages: + msg71710
nosy: + benjamin.peterson
2008-08-22 00:19:55tavcreate