summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Peuch <cortex@worlddomination.be>2020-05-20 20:46:18 +0200
committerLaurent Peuch <cortex@worlddomination.be>2020-05-20 20:46:18 +0200
commit7a3203391ad5e067ae85531bdad6f0356a9d50e3 (patch)
treec20c70046b98a6fbb6d94c5bc4cb1ce8107953a3
parent58581cb71b2711a0656639e5b75281dd6a1f54c3 (diff)
downloadlogilab-common-7a3203391ad5e067ae85531bdad6f0356a9d50e3.tar.gz
[modutils/doc] add docstring to LazyObject
-rw-r--r--logilab/common/modutils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py
index 34419bd..868dfa0 100644
--- a/logilab/common/modutils.py
+++ b/logilab/common/modutils.py
@@ -79,6 +79,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