Author r.david.murray
Recipients iter, r.david.murray, terry.reedy
Date 2018-04-26.21:04:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The rule in Python is that when a function mutates its argument it does *not* return a pointer to the object it just mutated, and likewise a method does *not* return a pointer to the parent object.  Usually this means a mutating function/method return None, but there are a number of exceptions (dict.pop(), for example).

If I understand correctly, in this case the method is returning the object that is its argument, and *that* object is not changed.  So I'd say this is an edge case.  Given the existence of a standard, I think it would probably be reasonable to implement it that way.  You could think of it as analogous to list.pop(N), although in that case the argument is not what is returned, but rather the value.  I think it is still analogous, though, since the way you identify the node to pop in this case is by its pointer.

In the absence of a standard I'd be inclined to say no, by the way.  I generally don't like chaining APIs :)  So, my word should not be considered final on this, it's just my opinion, and "don't echo an argument" is indeed a generally observed rule in Python APIs, as far as I can tell.
Date User Action Args
2018-04-26 21:04:14r.david.murraysetrecipients: + r.david.murray, terry.reedy, iter
2018-04-26 21:04:14r.david.murraysetmessageid: <>
2018-04-26 21:04:14r.david.murraylinkissue33274 messages
2018-04-26 21:04:14r.david.murraycreate