[Python-Dev] Re: [I18n-sig] Unicode experience

Tim Peters tim_one@email.msn.com
Fri, 7 Jul 2000 16:39:00 -0400

>>> For strings there is no compact notation like "+0.0" if you want to
>>> convert to string or Unicode -- adding "" might work in Perl, but not
>>> in Python.

BTW, "+0.0" is not a correct way to "boundedly coerce" to float under 754
arithmetic; "*1.0" is safer (the former does not always preserve the sign
bit of a float zero correctly, but the latter does).

[Paul Prescod]
>> Actually, these days, foo+"" works in a LOT of languages. Perl, Java and
>> JavaScript for sure.

> Really?  Does 3+"" really convert the 3 to a string in Java?

I don't remember about that specifically, but believe ""+3 does.  OTOH, in
*Perl* 3+"" converts "" to the *number* 0 and leaves 3 alone.

>> Python's strictness about this issue has never caught a bug for me. It
>> has only caused errors.

> Are you sure?  This is the kind of error where you immediately see
> what's wrong and move on to the next bug.

It's certainly caught errors for me, and especially when introducing Perl
programmers to Python, where "they expect" string+number to convert the
string to a number, apparently the opposite of the arbitrary choice Paul

It's ambiguous as hell -- screw it.