On Oct 2, 3:50 pm, Mel <[EMAIL PROTECTED]> wrote:
> rs387 wrote:
> > I see. Do you know whether this is seen as a problem with the language
> > design?
>
> No.
OK, I get it now. I was assuming that the "+" could be implemented in
terms of "+=" as follows:
def add(x,y):
temp = list(x)
temp
rs387 wrote:
> On Oct 2, 8:11 am, Erik Max Francis <[EMAIL PROTECTED]> wrote:
>> It's because the `+=` operator is doing the equivalent of calling the
>> `extend` method, which treats its argument as a generic sequence, and
>> doesn't enforce type.
>
> I see. Do you know whether this is seen as a
On Oct 2, 8:11 am, Erik Max Francis <[EMAIL PROTECTED]> wrote:
> It's because the `+=` operator is doing the equivalent of calling the
> `extend` method, which treats its argument as a generic sequence, and
> doesn't enforce type.
I see. Do you know whether this is seen as a problem with the langu
rs387 wrote:
I'm trying to understand why it is that I can do
a = []
a += 'stuff'
a
['s', 't', 'u', 'f', 'f']
but not
a = []
a = a + 'stuff'
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate list (not "str") to list
Can someone explain the logic? W
Hi
I'm trying to understand why it is that I can do
>>> a = []
>>> a += 'stuff'
>>> a
['s', 't', 'u', 'f', 'f']
but not
>>> a = []
>>> a = a + 'stuff'
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate list (not "str") to list
Can someone explain the logi