This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Date 2004-05-12.07:32:08
SpamBayes Score
Marked as misclassified
Logged In: YES 

The lazy_bind version has survived over of a month of my 
testing and multiple read throughs of the code :-)

I'm not expert with graminit.h but did wonder if testlist_gexp
could have a high numbered code so that other codes would 
not have to be re-numbered.

When you get back from military camp, please load the 
version that precomputes the outermost iterable.  I believe 
that is Guido's currently favored approach.  Currently, it fails 
this test:

>>> x = 10
>>> g = (i*i for i in range(x))
>>> x = 5
>>> list(g)    # should be ten items long
[0, 1, 4, 9, 16] 

Tim, summarized it as:

 ... Guido favored mostly-late binding -- which is late 
binding, except that the iterable in the leftmost for-clause is 
evaluated at once.  So

    ... (e1 for stuff in e2 for morestuff in e3 ...) ...

is effectively replaced by

    def __g(primary):
        for stuff in primary:
           for morestuff in e3:
                 yield e1

    ... __g(e2) ...


Date User Action Args
2007-08-23 15:31:39adminlinkissue872326 messages
2007-08-23 15:31:39admincreate