Fluent interface in python

Fluent Interface is an implementation of API which improves readability. Example Poem('The Road Not Taken').indent(4).suffix('Robert Frost'). Fluent Interface is similar to method chaining. I was wondering how to implement this in Python.Returning self during method call seemed good idea . class Poem(object): def __init__(self, content): self.content = content def indent(self, spaces=4): self.content = " " * spaces + self.content return self def suffix(self, content): self.content += " - {}".format(content) return self def __str__(self): return self. [Read More]