title: python decorator to modify variable in current scope
body: <p>Goal:  Make a decorator which can modify the scope that it is used in.</p>
  
  <p>If it worked:</p>
  
  <pre><code>class Blah(): # or perhaps class Blah(ParentClassWhichMakesThisPossible)
  
      def one(self):
          pass
  
      @decorated
      def two(self):
          pass
  
  &gt;&gt;&gt; Blah.decorated
  ["two"]
  </code></pre>
  
  <p>Why?  I essentially want to write classes which can maintain specific dictionaries of methods, so that I can retrieve lists of available methods of different types on a per class basis. errr.....</p>
  
  <p>I want to do this:</p>
  
  <pre><code>class RuleClass(ParentClass):
      @rule
      def blah(self):
          pass
  
      @rule
      def kapow(self):
          pass
  
      def shazam(self):
  
  class OtherRuleClass(ParentClass):
      @rule
      def foo(self):
          pass
  
      def bar(self):
          pass
  
  &gt;&gt;&gt; RuleClass.rules.keys()
  ["blah", "kapow"]
  &gt;&gt;&gt; OtherRuleClass.rules.keys()
  ["foo"]
  </code></pre>