[I18n-sig] Concatenation
Toby Dickenson
tdickenson@geminidataloggers.com
Thu, 08 Feb 2001 11:03:16 +0000
On Wed, 07 Feb 2001 19:30:59 -0800, Paul Prescod
<paulp@ActiveState.com> wrote:
>Would anyone out there that would object if this were allowed in Python
>2.1:
In 2.1, yes.
=46or as long as we have text data stored in a mix of string and unicode
objects, this rule is a good way of picking up encoding-assumption
bugs early.
(for 2.0 I argued against this, but today I can recognise its
usefulness)
>>>> u"abc"+"\245"
>u"abc\245"
Of course, this should work once type(u"abc")=3D=3Dtype("\245"). I think
we agree this is the long term goal.
>I wonder if anyone would argue that
>the code above is ambiguous in its intent.
A small variation:
>>> x =3D 'd'
>>> print u"abc"+x
abcd
>>> x =3D "\245"
>>> print u"abc"+x
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)
Toby Dickenson
tdickenson@geminidataloggers.com