diff options
Diffstat (limited to 'logilab/common/modutils.py')
-rw-r--r-- | logilab/common/modutils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py index bc467b3..6e65fb9 100644 --- a/logilab/common/modutils.py +++ b/logilab/common/modutils.py @@ -94,6 +94,17 @@ class NoSourceFile(Exception): class LazyObject(object): + """ + This class allows to lazyly declare a object (most likely only a callable + according to the code) from a module without importing it. + + The import will be triggered when the user tries to access attributes of + the object/callable or call it. + + Trying to set or delete attributes of the wrapped object/callable will not + works as expected. + """ + def __init__(self, module, obj): self.module = module self.obj = obj |