ionelmc / python-lazy-object-proxy

A fast and thorough lazy object proxy.
BSD 2-Clause "Simplified" License
247 stars 36 forks source link

Override factory or wrapped instance? #14

Closed Tinche closed 8 years ago

Tinche commented 8 years ago

Hi,

this isn't really a bug report, just a question. Is it possible to override the factory function before the proxy has been called the first time? Main use case would be test fixtures.

ionelmc commented 8 years ago

Hey, you can set __factory__. There are even some testcases for such use: https://github.com/ionelmc/python-lazy-object-proxy/blob/master/tests/test_lazy_object_proxy.py#L1708-L1746

Tinche commented 8 years ago

Thanks for the tip!