On Sun, Jan 19, 2020 at 3:56 PM Steven D'Aprano
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.
I'm not sure what you intend here: A fluent interface is normally implemented by using method chaining https://en.wikipedia.org/wiki/Method_chaining to implement method cascading https://en.wikipedia.org/wiki/Method_cascading (in languages that do not natively support cascading), concretely by having each method return this https://en.wikipedia.org/wiki/This_(computer_programming) ( self). While there are other things that might make a fluent interface, method chaining is by far the most commonly used approach.
result = mystring.upper().strip().center(width).encode('utf-8')
But yes, there are places in Python where "fluency" is the normal style. I was careful to say "collections" and "mutate" in my prior comments. A string is a kinda-sorta collection, but it's definitely not mutable.
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 :-)
I don't really see what you mean in Fowler that would allow "non-fluent" method chaining, but I'll stipulate there's some sentence I missed or read wrong. Nowadays, the term is in more widespread use, and exactly what Fowler meant in 2005 isn't really essential. For example, I definitely think of pipes between Unix commands using the shell as a "fluent interface" (that I like very much). That's not method calls, but it is absolutely *chaining*. -- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.