memberOf¶
- lsst.sconsUtils.utils.memberOf(cls, name=None)¶
A Python decorator that injects functions into a class.
- Parameters:
Notes
For example:
class test_class: pass @memberOf(test_class): def test_method(self): print("test_method!")
…will cause
test_method
to appear as as if it were defined withintest_class
.The function or method will still be added to the module scope as well, replacing any existing module-scope function with that name; this appears to be unavoidable.