Perl is worse!
Erik Max Francis
max at alcyone.com
Fri Jul 28 15:14:31 EDT 2000
Steve Lamb wrote:
> Nope. 1 + "foo" = 1. Perl uses the a different syntax to put
> strings
> together. + is only a mathematical operator, not a math and string
> operator.
In Perl you need two operators for mathematical addition (+) and string
concatination (.) because Perl is very weakly typed. Python is strongly
typed, so this is unnecessary. + for integers (floats, longs, etc.)
means addition, and + for strings means concatenation. What you're
suggesting is mixing the two meanings, which is horribly ambiguous and a
terribly bad idea for a strongly typed language.
If 1 + 1 == 2 and '1' + '1' == '11' (note, not 11), then what should 1 +
'1' or '1' + 1 do? Implicit type conversion between incompatible types
(integer and string) is a bad idea in a strongly-typed language.
That's not how it's done in Perl, but who cares? This isn't Perl, and
in fact Python's strong typing means that looking to Perl for language
advice is a very bad idea, because the way Perl works is predicated on
its weak typing.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ You must surely know / If man made Heaven, then man made Hell
\__/ Level 42
Interstelen / http://www.interstelen.com/
A multiplayer, strategic, turn-based Web game on an interstellar scale.
More information about the Python-list
mailing list