[Python-Dev] bytes / unicode

Baptiste Carvello baptiste13z at free.fr
Thu Jun 24 18:58:59 CEST 2010


P.J. Eby a écrit :

> [...] stdlib constants are almost always ASCII, 
> and the main use cases for ebytes would involve ascii-extended encodings.)

Then, how about a new "ascii string" literal? This would produce a special kind 
of string that would coerce to a normal string when mixed with a str, and to a 
bytes using ascii codec when mixed with a bytes. Then you could write

 >>> a"/".join(base, path)

and not worry if base and path are both str, or both bytes (mixed being of 
course forbidden).

B.



More information about the Python-Dev mailing list