title: Implement method chaining in a class in Python
body: <p>I was going through the documentation of using Fluent interfaces in Python and came across this package : <a href="https://pypi.org/project/fluentpy/" rel="nofollow noreferrer">https://pypi.org/project/fluentpy/</a>.</p>
  <p>I created a rather contrived example to test this like the below Persons class :</p>
  <pre><code>class Persons:
      def __init__(self, names):
          self.names = names
          
      def get_lengths(self):
          return [len(name) for name in self.names]
      
      def get_name_length_map(self, lengths):
          return {
              name: length
              for name, length in zip(self.names, lengths)
          }
  </code></pre>
  <p>As we can see that the methods <code>get_lengths</code> and <code>get_name_length_map</code> can be chained .</p>
  <p>Below is a simple example of how we use this class in the simple case(without using fluentpy):</p>
  <pre><code>p = Persons([&quot;Subhayan&quot;, &quot;Ralf&quot;, &quot;Thomas&quot;, &quot;Leo&quot;])
  
  print(p.get_lengths())
  
  print(p.get_name_length_map(p.get_lengths()))
  </code></pre>
  <p>Can someone please point me to a way in which i can do method chaining here using fluentpy ? Is there some change to the class that i have to do to make it work ?</p>
  <p>Any help would be greatly appreciated.</p>