Little problem with the "+" operator
joconnor at cybermesa.com
Mon Mar 5 18:59:27 CET 2001
On 05 Mar 2001 09:38:49 -0800, Johann Hibschman
<johann at physics.berkeley.edu> wrote:
>Joshua Marshall writes:
>>> This is infinitely more sane than:
>>> % perl -e 'print 500 + "cool"'
>> Comparing Python to Perl here doesn't seem very fair. They're very
>> different languages. In general, I'm surprised by the urgency with
>> which people often jump to compare them.
>Well, Perl's the only language that I know of that lets you add 500 to
>"cool" without an error. Well, I suppose tcl might. But it's still a
>fairly safe inference that the original poster was coming from Perl.
'100' + 200 = '100200'
100 + '200' = 300
I *think* that's how it works, I just know it's not very safe
More information about the Python-list