diff --git a/docs/usage.rst b/docs/usage.rst index 3e6e66d..1cfd791 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -5,3 +5,27 @@ Usage To use lazy-object-proxy in a project:: import lazy_object_proxy + + def heavyweight_function(): + result = "something_big" + return result + + my_big_thing = lazy_object_proxy.Proxy(heavyweight_function) + +To do lazy object initialization:: + + class BloatedClass(object): + def __init__(self): + self.a = AnotherClass() + self.b = {} + + def get_bloated_dict(self): + return self.b + + def bloated_class_init(): + return BloatedClass() + + # This will not instantiate the class + # so to the heavyweight init will not be run yet. + + my_bloated_object = lazy_object_proxy.Proxy(bloated_class_init)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: