list.extend() should return self

Please, is there a reason why extend() method does not return self?

On 3/3/21 3:23 PM, Hans Ginzel wrote:
I think it just the general principle that mutating methods return None, while methods that create a new object return that object. Thus you use the return type if you expect a new object, and getting None alerts you to the fact that it mutated the original instead of just makeing a new object for the answer. -- Richard Damon

Methods that mutate their argument typically return None, to avoid confusing them with methods that return copies; If you both mutate and return a copy it is easy to end up with shared objects in place you actually don't want them
... oops. -- M On Wed, 3 Mar 2021 at 12:43, Hans Ginzel <hans@matfyz.cz> wrote:

On 3/3/21 3:23 PM, Hans Ginzel wrote:
I think it just the general principle that mutating methods return None, while methods that create a new object return that object. Thus you use the return type if you expect a new object, and getting None alerts you to the fact that it mutated the original instead of just makeing a new object for the answer. -- Richard Damon

Methods that mutate their argument typically return None, to avoid confusing them with methods that return copies; If you both mutate and return a copy it is easy to end up with shared objects in place you actually don't want them
... oops. -- M On Wed, 3 Mar 2021 at 12:43, Hans Ginzel <hans@matfyz.cz> wrote:
participants (3)
-
Hans Ginzel
-
Matthias Bussonnier
-
Richard Damon