On 27 October 2014 01:14, Jon Ribbens <jon+use...@unequivocal.co.uk> wrote:

> I have a need, in a Python C extension I am writing, for lists and
> dictionaries with "lazy evaluation" - by which I mean that at least
> some of the values in the lists/dictionaries are "proxy objects"
> which, rather than returning as themselves, should return the thing
> they are a proxy for when retrieved. This is because retrieving
> the proxied objects is expensive and only a small minority of them
> will actually be accessed, so retrieving them all before they are
> actually accessed is massively inefficient.
>

Why not put proxy objects into the list/dict? Have a look at the weakref
module for an API that may be suitable for such proxy objects (if you used
the same API, that would also allow you to transparently use weakrefs in
your lists/dicts).

Tim Delaney
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to