title: Python decorator @func().attribute syntax error
body: <p>I tried to find an answer here, but could not.</p>
  
  <pre><code>@obj.func # works
  @obj.func(**kwargs)  #works
  @obj.func1(**kwargs).func2   #-&gt; syntax error 
  </code></pre>
  
  <p>I do not understand why the third form is a SyntaxError, it seems for me that is not violating any python syntax and it is clear for me what the user want to do (see example below).</p>
  
  <p>I looked at <a href="https://www.python.org/dev/peps/pep-0318/" rel="nofollow">pep 0318</a> of decorator implementation but didn't find any answers.</p>
  
  <p>Here bellow, would be an example of use:</p>
  
  <pre><code>class ItemFunc(object):
      def __init__(self, fcall=None, **kwargs):
          self.defaults = kwargs
          self.fcall = None
  
      def __call__(self, *args, **kwargs):
          kwargs = dict(self.defaults, **kwargs)
          # do something more complex with kwargs 
          output = self.fcall(*args, **kwargs)
          # do something more with output  
          return output
  
      def caller(self, fcall):
          """ set call and return self """
          self.call = fcall # after some check obviously
          return self
  
      def copy(self,**kwargs):
          kwargs = dict(self.defaults, **kwargs)
          return self.__class__(self.fcall, **kwargs)
  
      def copy_and_decorate(self, **kwargs):
          return self.copy(**kwargs).caller 
  </code></pre>
  
  <p>Than you can use ItemFunc as a decorator:</p>
  
  <pre><code>@ItemFunc
  def plot(**kwargs):
      pass
  
  redcross = plot.copy(color="red", marker="+")
  @redcross.caller
  def plot_data1(**kwargs):
      pass
  
  bluecross = redcross.copy(color="blue")
  @bluecross.caller
  def plot_data2(**kwargs):
      pass
  </code></pre>
  
  <p>But why this following 'short cut syntax' is forbidden :</p>
  
  <pre><code>@redcross.copy(color="blue").caller
  def plot_data2(**kwargs):
      pass
  </code></pre>
  
  <p>But I can do:</p>
  
  <pre><code>@redcross.copy_and_decorate(color="blue")
  def plot_data2(**kwargs):
      pass         
  </code></pre>
  
  <p>The first form looks for nicer, at least I understand better the intentions behind.</p>