New submission from Richard King <rickbk...@comcast.net>:

x = ['a']

x += ' ' results in ['a',' ']

x = x + ' ' results in an exception:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: can only concatenate list (not "str") to list

It behaves the same in 2.7.15 and 3.7.2.

----------
components: Windows
messages: 364213
nosy: paul.moore, rickbking, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: adding a string to a list works differently with x+='' compared to x=x+''
type: behavior
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39964>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to