Inconsistent reaction to extend

Timo timo.linna at gmail.com
Fri Sep 9 06:04:45 EDT 2005


Jerzy Karczmarczuk kirjoitti:

> On the other hand, try
>
> p=range(4).extend([1,2])
>
> Then, p HAS NO VALUE (NoneType).
>
> With append the behaviour is similar. I didn't try other methods, but
> I suspect that it won't improve.
>
>
> WHY?

range(4) returns a list and Python's list.extend() returns None. Extend
is a in-place operation.

-- timo




More information about the Python-list mailing list