On Sun, Jan 19, 2020 at 02:37:14PM -0500, David Mertz wrote: > The "fluent interface" (https://en.wikipedia.org/wiki/Fluent_interface) is > popular in many programming languages, including in the sort of > "mini-language" Pandas, within portion.
I can't speak about Pandas, but what the OP is expecting to do is not a fluent interface. It's just method chaining. We do method chaining all the time with immutable "value objects" like strings: result = mystring.upper().strip().center(width).encode('utf-8') and nobody blinks an eye or calls it unpythonic. A fluent interface is built on top of method chaining: you can't (easily?) have a fluent interface without chaining, but you can have chaining without a fluent interface. See Fowler, who came up with the term and ought to know what he meant by it :-) https://www.martinfowler.com/bliki/FluentInterface.html In other words: merely returning "self" from your mutating methods does not make a fluent interface. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BTFBHHUX2JATQOWKK2ALO7ATCIQSKB2H/ Code of Conduct: http://python.org/psf/codeofconduct/