harmful str(bytes)

Terry Reedy tjreedy at udel.edu
Fri Oct 8 17:43:43 EDT 2010


On 10/8/2010 9:31 AM, Hallvard B Furuseth wrote:

> That's not the point - the point is that for 2.* code which _uses_ str
> vs unicode, the equivalent 3.* code uses str vs bytes.  Yet not the
> same way - a 2.* 'str' will sometimes be 3.* bytes, sometime str.  So
> upgraded old code will have to expect both str and bytes.

If you want to interconvert code between 2.6/7 and 3.x, use unicode and 
bytes in the 2.x code. Bytes was added to 2.6/7 as a synonym for str 
explicitly and only for conversion purposes.

-- 
Terry Jan Reedy




More information about the Python-list mailing list