lazy evaluation of a variable

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jun 17 19:01:03 EDT 2012


On Mon, 18 Jun 2012 07:44:47 +1000, Cameron Simpson wrote:

> On 17Jun2012 23:35, Gelonida N <gelonida at gmail.com> wrote: | I'm having
> a module, which should lazily evaluate one of it's variables. | Meaning
> that it is evaluated only if anybody tries to use this variable.
> 
> If it were an object member you could use a property. Does it need to be
> a module global?
> 
> In related news, can one make "properties" for modules? I was wondering
> about this a month or so ago.


There have been various half-hearted requests for such a feature, 
including by myself, but nothing concrete.

One day, in my Copious Spare Time, I intend to write a proper feature 
request and/or PEP for such a feature. Obviously the absolute earliest 
such a feature could be introduced is Python 3.4, about 18 months from 
now. (Although frankly, I would imagine significant opposition from the 
more conservative Python developers.)


-- 
Steven



More information about the Python-list mailing list