str() should convert ANY object to a string without EXCEPTIONS !

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Sep 28 08:05:11 CEST 2008


On Sat, 27 Sep 2008 22:37:09 -0700, est wrote:

> The problem is, why the f**k set ASCII encoding to range(128) ????????

Because that's how ASCII is defined.  ASCII is a 7-bit code.

> while str() is internally byte array it should be handled in range(256)
> !!!!!!!!!!

Yes `str` can handle that, but that's not the point.  The point is how to 
translate the contents of a `unicode` object into that range.  There are 
many different possibilities and Python refuses to guess and tries the 
lowest common denominator -- ASCII -- instead.

> I now spending 60% of my developing time dealing with ASCII range(128)
> errors. It was PAIN!!!!!!
> 
> Please fix this issue.
> 
> http://bugs.python.org/issue3648
> 
> Please.

The issue was closed as 'invalid'.  Dealing with Unicode can be a pain 
and frustrating, but that's not a Python problem, it's the subject itself 
that needs some thoughts.  If you think this through, the relationship 
between characters, encodings, and bytes, and stop dreaming of a magic 
solution that works without dealing with this stuff explicitly, the pain 
will go away -- or ease at least.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list