This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Carl.Friedrich.Bolz, Trundle, arigo, daniel.urban, eric.araujo, meador.inge, ncoghlan, terry.reedy
Date 2011-03-14.23:03:43
SpamBayes Score 3.6890935e-06
Marked as misclassified No
Message-id <1300143824.86.0.786235090512.issue11477@psf.upfronthosting.co.za>
In-reply-to
Content
I think Nick's point, and one I agree with, is (or amounts to):
  'somelist += ob' == 'somelist.__iadd__(ob)' ==
  'somelist.extend(ob)' == 'somelist[len(somelist):len(somelist)]=ob'
is defined and should be implemented for all somelist,ob pairs. If ob is an iterable, add the items at the end; if not, raise TypeError.

CPython currently has a bug that breaks the middle equality in a peculiar case. We recognize that and hope to fix it.

The proper, future-proof fix for Greg Price & Co. is for them to 
  1. use somelist.append(ob) to append a single object, iterable or not, to somelist. If they insist on (mis)using += for appending, 
  2. add the trivial __iter__ yielding just the instance to all classes whose instances are ever a target of 'somelist += instance'. Or
  3. wrap each non-iterable instance in an iterable, such as a tuple:
 "somelist += (non-iterable,).
Any of these (1. actually) should have been done in the first place, as has always been documented.
History
Date User Action Args
2011-03-14 23:03:44terry.reedysetrecipients: + terry.reedy, arigo, ncoghlan, Carl.Friedrich.Bolz, eric.araujo, Trundle, meador.inge, daniel.urban
2011-03-14 23:03:44terry.reedysetmessageid: <1300143824.86.0.786235090512.issue11477@psf.upfronthosting.co.za>
2011-03-14 23:03:43terry.reedylinkissue11477 messages
2011-03-14 23:03:43terry.reedycreate