On 4/29/06, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> I understand the underlying implementation of str.join can be a bit
> convoluted (with the auto-promotion to unicode and all), but I don't
> suppose there is any chance to get str.join to support objects which
> implement the buffer interface
Thomas Heller <[EMAIL PROTECTED]> wrote:
>
> Fredrik Lundh wrote:
> > Josiah Carlson wrote:
> >
> >> At least for the examples of buffers that I've seen, using the buffer
> >> interface for objects that support it is equivalent to automatically
> >> applying str() to them. This is, strictly spe
Fredrik Lundh wrote:
> Josiah Carlson wrote:
>
>> At least for the examples of buffers that I've seen, using the buffer
>> interface for objects that support it is equivalent to automatically
>> applying str() to them. This is, strictly speaking, an optimization.
>
> >>> a = array.array("i",
Josiah Carlson wrote:
> At least for the examples of buffers that I've seen, using the buffer
> interface for objects that support it is equivalent to automatically
> applying str() to them. This is, strictly speaking, an optimization.
>>> a = array.array("i", [1, 2, 3])
>>> str(a)
"
Edward Loper <[EMAIL PROTECTED]> wrote:
>
> Nick Coghlan wrote:
> > Edward Loper wrote:
> >> This is incompatible with the recent proposal making str.join
> >> automatically str-ify its arguments. i.e.:
> >>
> >>''.join(['a', 12, 'b']) -> 'a12b'.
> >>
> >> I don't feel strongly about either
Nick Coghlan wrote:
> Edward Loper wrote:
>> This is incompatible with the recent proposal making str.join
>> automatically str-ify its arguments. i.e.:
>>
>>''.join(['a', 12, 'b']) -> 'a12b'.
>>
>> I don't feel strongly about either proposal, I just thought I'd point
>> out that they're mut
Edward Loper wrote:
> This is incompatible with the recent proposal making str.join
> automatically str-ify its arguments. i.e.:
>
>''.join(['a', 12, 'b']) -> 'a12b'.
>
> I don't feel strongly about either proposal, I just thought I'd point
> out that they're mutually exclusive.
Doesn't a
Josiah Carlson wrote:
> [...] get str.join to support objects which
> implement the buffer interface as one of the items in the sequence?
>
> Something like:
>
> y = 'hello world'
> buf1 = buffer(y, 0, 5)
> buf2 = buffer(y, 6)
> print ''.join([buf1, buf2])
>
> should print "h
I understand the underlying implementation of str.join can be a bit
convoluted (with the auto-promotion to unicode and all), but I don't
suppose there is any chance to get str.join to support objects which
implement the buffer interface as one of the items in the sequence?
Something like: