why no automatic conversion in string concatenation?
Michael Pelz Sherman
mpelzsherman at yahoo.com
Tue Nov 13 10:15:06 EST 2007
As a Java & PHP developer, I find it kind of annoying that I have to explicitly convert non-string variables to strings when concatenating them, especially when python is quite capable of doing the conversion automatically.
i.e.:
>>> myBool = True
>>> print myBool
True
>>> print "myBool is " + myBool
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'bool' objects
>>> print "myBool is " + str(myBool)
myBool is True
Can anyone explain why this is so? Are there any plans to change this in python 3000?
Thanks,
- Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071113/accfb35f/attachment.html>
More information about the Python-list
mailing list