On 2014-02-21, at 23:00 , spir <denis.spir@gmail.com> wrote:
Also, I don't find the idea of having a builtin construct for such hacks a good idea. Libs for which this may be practicle can return self --end of the story.
That has two issues though: 1. it makes chainability a decision of the library author, the library user gets to have no preference. This means e.g. you can't create a tree of elements in ElementTree in a single expression (AFAIK Element does not take children parameters). With cascading, the user can "chain" a library whose author did not choose to support chaining (in fact with cascading no author would ever need to support chaining again). 2. where a return value can make sense (and be useful) the author *must* make a choice. No way to chain `dict.pop()` since it returns the popped value, even if `pop` was only used for its removal-with-shut-up properties. With cascading the user can have his cake and eat it: he gets the return value if he wants it, and can keep "chaining" if he does not care.