Closed neRok00 closed 9 years ago
If you want a non-lazy proxy you should use wrapt: http://wrapt.readthedocs.org/en/latest/wrappers.html#object-proxy
Yer, that works, thanks.
It just seems a bit silly using 1 rather small object from a larger module, especially considering that object isn't even the focus of the module.
I was looking for a proxy object, but I don't require the lazy functionality, and this package implements a rather good proxy. I have succeeded with the following code, but it only works with the
slots.Proxy
class, and doesn't seem to with the others. Perhaps it would be a good feature to implement a regular proxy, then the lazy proxy inherits and upgrades it to add the lazy functionality?BTW, I could have called
LazyProxy(lambda: target)
, or have changed the__init__
above to something likesuper().__init__(lambda: target)
, but it just seems like a bunch of extra work having to create and run a lambda function when I don't actually require it.