1
0

decorate.py 723 B

12345678910111213141516171819
  1. # usage:
  2. #
  3. # o.method = decorate_func(somefunc, o.method)
  4. #
  5. # The contents of this file are subject to the Python Software Foundation
  6. # License Version 2.3 (the License). You may not copy or use this file, in
  7. # either source code or executable form, except in compliance with the License.
  8. # You may obtain a copy of the License at http://www.python.org/license.
  9. #
  10. # Software distributed under the License is distributed on an AS IS basis,
  11. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. # for the specific language governing rights and limitations under the
  13. # License.
  14. def decorate_func(new, old):
  15. def runner(*a, **kw):
  16. new(*a, **kw)
  17. return old(*a, **kw)
  18. return runner