diff options
author | Laurent Peuch <cortex@worlddomination.be> | 2020-05-20 20:46:18 +0200 |
---|---|---|
committer | Laurent Peuch <cortex@worlddomination.be> | 2020-05-20 20:46:18 +0200 |
commit | cfc6d86916a4080d7ca805d62887977b80b86b3f (patch) | |
tree | a82ff5eddc8ba6b15c268c7d93c7be2c556ade3a | |
parent | 9ac835a2f9057c4bd56f1c583fbe0019641b4b32 (diff) | |
download | logilab-common-cfc6d86916a4080d7ca805d62887977b80b86b3f.tar.gz |
[modutils/doc] add docstring to LazyObject
-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 |