[I18n-sig] Re: Pre-PEP: Proposed Python Character Model

Fredrik Lundh fredrik@effbot.org
Sun, 11 Feb 2001 11:51:29 +0100


> >I would want to avoid the need for a 2.0-style 'default encoding', so I
> >Suggest it shouldnt be possible to mix this type with other strings:
> >
> >>>> "1"+b"2"
> >Traceback (most recent call last):
> >  File "<stdin>", line 1, in ?
> >TypeError: cannot add type "binary" to string
> >>>> "3"=3D=3Db"3"
> >0

a more pragmatic approach would be to assume ASCII en-
codings for binary data, and choke on non-ASCII chars.

>>> "1" + b"2"
12
>>> "1" + buffer("2")
12
>>> "1" + b"\xff"
ValueError: ASCII decoding error: ordinal not in range(128)

Cheers /F