title: Getting the instance of a class decorated function
body: <p>I have a class as follows:</p>
  <pre class="lang-py prettyprint-override"><code>class A:
      def __init__(self, x, y):
          self.x = x
          self.y = y
  
      def __call__(self, func):
          def wrapper():
              print(&quot;decorated&quot;, self.x, self.y)
              func()
          return wrapper
  </code></pre>
  <p>Now if I want to use this class to decorate functions:</p>
  <pre class="lang-py prettyprint-override"><code>@A(4, 5)
  def fn():
    print(&quot;original function&quot;)
  
  fn()
  </code></pre>
  <p>Output:</p>
  <pre><code>decorated 4 5
  original function
  </code></pre>
  <p>Questions:</p>
  <ol>
  <li><p>Since in <code>@A(3, 4)</code> the <code>__init__</code> class constructor is called, where did the created instance of class <code>A</code> go? Is there a way to reference it?</p>
  </li>
  <li><p>How can I access the properties <code>self.x, self.y</code> outside of the class, without calling <code>fn()</code>?
  (I want something like <code>fn.x</code> or <code>fn.y</code>, but they don't work)</p>
  </li>
  </ol>