[Python-Dev] Wierd buffer "add" behaviour.
M.-A. Lemburg
mal@lemburg.com
Mon, 16 Oct 2000 09:50:22 +0200
Mark Hammond wrote:
>
> 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 just seems plain wrong. Adding two buffers should yield
a new buffer -- in the long run, buffers should replace strings
wrt to holding binary data. If not even buffers themselves
implement this idea, I don't see any perspective for ever getting
there...
> 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?
Neither to me.
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/