Using python decorator functions from a different module

Posted by user328069 on Stack Overflow See other posts from Stack Overflow or by user328069
Published on 2010-05-03T10:49:33Z Indexed on 2010/05/03 11:38 UTC
Read the original article Hit count: 291

Filed under:
|
|

I want to use a function from another module as a decorator, but I need it to manipulate the current module's global namespace.

For example, I want to be able to go from this:

class SomeClass:
    pass

root = SomeClass

to this:

from othermodule import decorator

@decorator
class Someclass:
    pass

Any ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about python-decorators