Greg Stein wrote: > > On Mon, Oct 16, 2000 at 09:50:22AM +0200, M.-A. Lemburg wrote: > > Mark Hammond wrote: > >... > > > 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. > > It is caused by the non-commutative aspect of Python types. You end up with > a string, and that type doesn't know how to add a buffer to itself. The problem is that buffer() objects coerce to strings in the first place... they should return new buffer objects instead of strings -- then we wouldn't have the above problems. > ... > Of course, the choice of returning a string (from buf+buf) rather than a > buffer was arguably the wrong choice. Right :-/ -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4