On Fri, 17 Jun 2016 12:02 pm, Lawrence D’Oliveiro wrote:

> Some kinds of objects often receive a whole lot of method calls in
> sequence. In these situations, it is handy if each method call ends with
> “return self”, so that you can chain the calls together. This is
> particularly common with graphics APIs, for instance.
[...]


Yes, this is design that (for example) Ruby classes tend to follow. It's not
one that the Python builtins tend to follow, but of course people are free
to return self from their own classes' methods if they like.

As an alternative, you might find this simple adaptor useful:

http://code.activestate.com/recipes/578770-method-chaining/



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to