R. David Murray <rdmur...@bitdance.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33274>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to