unicode string literals and "u" prefix

Just just at xs4all.nl
Wed Nov 10 04:14:48 EST 2004


In article <kxkkd.10213$O11.6559 at newsread3.news.pas.earthlink.net>,
 Andrew Dalke <adalke at mindspring.com> wrote:

> Martin v. Löwis wrote:
> > If you really need a way of declaring all string literals as Unicode,
> > on a per-module basis, then
> > 
> > from __future__ import string_literals_are_unicode
> 
> Were it to be done, would that also introduce new syntax for
> generating a byte string?
> 
> Perhaps b"" as in
> 
>   s = b"\N{LATIN"
> 
> ?

IMO we should plan to move towards the following:

   - all string literals should become unicode
   - there should be a bytes() type for binary
     strings
   - there should be a way to use byte string
     literals. b"..." seems a good candidate.

I doubt this can be done without breaking stuff (although a __future__ 
directive may make it possible), so maybe this is a 3.0 project.

There already is a PEP for a bytes type:
  http://www.python.org/peps/pep-0296.html
..but it seems it's been dormant since 2002. Time to revive it?

Just



More information about the Python-list mailing list