[ python-Bugs-955772 ] Nested generator terminates prematurely

SourceForge.net noreply at sourceforge.net
Tue May 18 06:04:40 EDT 2004


Bugs item #955772, was opened at 2004-05-18 13:02
Message generated for change (Comment added) made by ygale
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=955772&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Yitz Gale (ygale)
Assigned to: Nobody/Anonymous (nobody)
Summary: Nested generator terminates prematurely

Initial Comment:
def g(x, y):
  for i in x:
    for j in y:
      yield i, j

r2 = (0, 1)
[e for e in g(r2, g(r2, r2))]

Expected result:

[(0, (0, 0)), (0, (0, 1)), (0, (1, 0)), (0, (1, 1)),
 (1, (0, 0)), (1, (0, 1)), (1, (1, 0)), (1, (1, 1))]

Actual result:

[(0, (0, 0)), (0, (0, 1)), (0, (1, 0)), (0, (1, 1))]

----------------------------------------------------------------------

>Comment By: Yitz Gale (ygale)
Date: 2004-05-18 13:04

Message:
Logged In: YES 
user_id=1033539

Trying again to get the indentation correct:

def g(x, y):
  for i in x:
    for j in y:
      yield i, j


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=955772&group_id=5470



More information about the Python-bugs-list mailing list