Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79725

Re: Lazy-evaluation lists/dictionaries

References <slrnm4q0ej.p8n.jon+usenet@frosty.unequivocal.co.uk>
Date 2014-10-27 07:36 +1100
Subject Re: Lazy-evaluation lists/dictionaries
From Tim Delaney <timothy.c.delaney@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15199.1414356081.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 27 October 2014 01:14, Jon Ribbens <jon+usenet@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

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Lazy-evaluation lists/dictionaries Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2014-10-26 14:14 +0000
  Re: Lazy-evaluation lists/dictionaries Tim Delaney <timothy.c.delaney@gmail.com> - 2014-10-27 07:36 +1100
    Re: Lazy-evaluation lists/dictionaries Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2014-10-27 15:11 +0000
  Re: Lazy-evaluation lists/dictionaries Terry Reedy <tjreedy@udel.edu> - 2014-10-26 18:41 -0400
    Re: Lazy-evaluation lists/dictionaries Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2014-10-27 15:03 +0000

csiph-web