On Sunday, June 17, 2012 6:01:03 PM UTC-5, Steven D'Aprano wrote:
> 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. (Alt
On 06/17/2012 11:35 PM, Gelonida N wrote:
Hi,
I'm not sure whether what I ask for is impossible, but would know how
others handle such situations.
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.
On 6/17/2012 5:35 PM, Gelonida N wrote:
I'm having a module, which should lazily evaluate one of it's variables.
If you literally mean a module object, that is not possible. On the
other hand, it is easy to do with class instances, via the __getattr__
special method or via properties.
At
Another option would be to refactor your function so that it is a generator
expression using the yield keyword.
On Sun, Jun 17, 2012 at 7:40 PM, Peter Otten <__pete...@web.de> wrote:
> Gelonida N wrote:
>
> > I'm having a module, which should lazily evaluate one of it's variables.
> > Meaning th
Gelonida N 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.
>
> At the moment I don't know how to do this and do therefore following:
>
>
> ### mymodule.py ###
> var = None
>
> d
On Mon, 18 Jun 2012 07:44:47 +1000, Cameron Simpson wrote:
> On 17Jun2012 23:35, Gelonida N 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 u
On 17Jun2012 23:35, Gelonida N 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, c
Hi,
I'm not sure whether what I ask for is impossible, but would know how
others handle such situations.
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.
At the moment I don't know how to do thi