Use the decorator module

You can use the decorator module to simplify things a bit:

  1. from decorator import decorator
  2. def loadedBy(loader):
  3. def result(self, *args, **kwargs):
  4. loader(self)
  5. return fn(self, *args, **kwargs)
  6. return decorator(result)

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags.
More information about formatting options