Re: lazy evaluation of a variable

Discussion in 'Python' started by Cameron Simpson, Jun 17, 2012.

  1. 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, can one make "properties" for modules? I was wondering
    about this a month or so ago.
    --
    Cameron Simpson <>

    If your new theorem can be stated with great simplicity, then there
    will exist a pathological exception. - Adrian Mathesis
     
    Cameron Simpson, Jun 17, 2012
    #1
    1. Advertisements

  2. 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 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
     
    Steven D'Aprano, Jun 18, 2012
    #2
    1. Advertisements

  3. Cameron Simpson

    Guest

    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. (Although frankly, I would imagine significant opposition from the
    > more conservative Python developers.)


    Well these conservatives must have been suffering from chronic mononucleosis because i have never heard a peep from them! I wish they would "grow a pair" and speak up a bit more often because the language would benefit greatly from some austerity measures, strong leadership, and most of all; some Gawd damned consistency!
     
    , Jun 19, 2012
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    439
  2. sturlamolden
    Replies:
    9
    Views:
    992
    Antoon Pardon
    May 3, 2007
  3. Boltar

    Lazy evaluation question

    Boltar, Jan 5, 2008, in forum: C Programming
    Replies:
    40
    Views:
    1,361
    Peter Nilsson
    Jan 10, 2008
  4. Ken Pu
    Replies:
    3
    Views:
    848
    Steven D'Aprano
    Jan 16, 2009
  5. markolopa
    Replies:
    6
    Views:
    478
    Steven D'Aprano
    Nov 12, 2009
  6. Michael Neumann

    Lazy evaluation

    Michael Neumann, Apr 30, 2004, in forum: Ruby
    Replies:
    50
    Views:
    703
    Paul Brannan
    May 4, 2004
  7. Daniel Nugent

    Generators via Lazy Evaluation

    Daniel Nugent, Oct 29, 2005, in forum: Ruby
    Replies:
    0
    Views:
    150
    Daniel Nugent
    Oct 29, 2005
  8. Gelonida N

    lazy evaluation of a variable

    Gelonida N, Jun 17, 2012, in forum: Python
    Replies:
    0
    Views:
    284
    Gelonida N
    Jun 17, 2012
Loading...