Skip to content

Commit b2b6cb0

Browse files
committed
Add docstring for Proxy class.
1 parent cd58298 commit b2b6cb0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/lazy_object_proxy/slots.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ def __new__(cls, name, bases, dictionary):
6161

6262

6363
class Proxy(with_metaclass(_ProxyMetaType)):
64+
"""
65+
A proxy implementation in pure Python, using slots. You can subclass this to add
66+
local methods or attributes, or enable __dict__.
67+
68+
The most important internals:
69+
70+
* ``__factory__`` is the callback that "materializes" the object we proxy to.
71+
* ``__target__`` will contain the object we proxy to, once it's "materialized".
72+
* ``__wrapped__`` is a property that does either:
73+
74+
* return ``__target__`` if it's set.
75+
* calls ``__factory__``, saves result to ``__target__`` and returns said result.
76+
"""
77+
6478
__slots__ = '__target__', '__factory__'
6579

6680
def __init__(self, factory):

0 commit comments

Comments
 (0)