[Python-Dev] Re: [I18n-sig] Unicode experience
Paul Prescod
paul@prescod.net
Fri, 07 Jul 2000 18:04:20 -0500
Guido van Rossum wrote:
>
> Really? Does 3+"" really convert the 3 to a string in Java?
class foo{
void foo(){
System.err.println( 5+"" );
}
}
> > C++, depending on the type. 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.
I am sure that 99% of the time when I get an error message trying to add
a string to something, it is because I expect the thing to be
automatically coerced to the string. This probably comes from the other
languages I have used.
>
> 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
> prefers.
>
> It's ambiguous as hell -- screw it.
I don't see the choice as arbitrary. Perl's choice is just insane. :)
According to the definition used in Java, Javascript and C++ (sometimes)
x+y
If y is a string then x+y is well-defined no matter what the type of x
or the content of y. Under the Perl definition, it totally depends on
the type of y and the contents of x. Insane!
I advocate special casing of strings (which are already special cased in
various ways) whereas Perl special cases particular string values.
Insane!
--
Paul Prescod - Not encumbered by corporate consensus
Pop stars come and pop stars go, but amid all this change there is one
eternal truth: Whenever Bob Dylan writes a song about a guy, the guy is
guilty as sin.
- http://www.nj.com/page1/ledger/e2efc7.html