[Python-Dev] Apparent bug in 2.2a1

Eric S. Raymond esr@thyrsus.com
Sun, 19 Aug 2001 19:54:49 -0400


# This trivial Python program fails.
#
# Python 2.2a1+ (#12, Aug 18 2001, 14:42:50) 
# [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-85)] on linux2
#
# To really confuse yourself, set xml to 0 and watch it run without error.

xml = 1
stem = "a"
if xml:
    stem += "b",
else:
    stem += "b"

# Here is the error I see:
#
# Traceback (most recent call last):
#   File "foo.py", line 11, in ?
#     stem += "b",
# TypeError: cannot add type "tuple" to string

-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

The world is filled with violence. Because criminals carry guns, we
decent law-abiding citizens should also have guns. Otherwise they will
win and the decent people will lose.
        -- James Earl Jones