Title: Builtin ascii() function from future_builtins includes leading "u" of unicode strings
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
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 2008-08-22 00:36 by benjamin.peterson. 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)

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.
Date User Action Args
2008-08-22 00:36:43benjamin.petersonsetstatus: open -> closed
resolution: wont fix
messages: + msg71710
nosy: + benjamin.peterson
2008-08-22 00:19:55tavcreate