Little problem with the "+" operator
Alex Martelli
aleaxit at yahoo.com
Fri Mar 16 09:09:26 EST 2001
"Blake Winton" <bwinton at tor.dhs.org> wrote in message
news:slrn9b35m0.lkh.bwinton at tor.dhs.org...
[snip]
> >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.
>
> Two words. Visual Basic.
The expression
x = 500 + "cool"
gives a runtime error 13 (type mismatch) in Visual Basic 6.
Even in *VBScript*, with its weaker-yet typing...:
== file boo.vbs
wscript.echo 500+"cool"
== end of file
D:\pybridge>cscript boo.vbs
Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.
D:\pybridge\boo.vbs(1, 1) Microsoft VBScript runtime error: Type mismatch:
'[stri
ng: "cool"]'
D:\pybridge>
So, I don't know what you mean...!
Alex
More information about the Python-list
mailing list