[Python-Dev] Wierd buffer "add" behaviour.

Mark Hammond MarkH@ActiveState.com
Mon, 16 Oct 2000 10:49:19 +1100


I just struck this, and wonder if it is intentional:

* Adding 2 buffer objects together yields a string.  Fair enough.
* Adding a buffer and a string yields a type error!  Eeek.

This yields the following strange behaviour:

>>> a=buffer('a')
>>> a+a
'aa'
>>> a+a+a
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
TypeError: cannot add type "buffer" to string
>>> 

That doesnt seem correct to me?

Mark.