Cross-Product Pairs Example : Yield : Statement PYTHON TUTORIALS


PYTHON TUTORIALS » Statement » Yield »

 

Cross-Product Pairs Example


rows = [12317]

def cols():        # example of simple generator
    yield 56
    yield 2
    yield 1

x_product_pairs = ((i, jfor i in rows for j in cols())

for pair in x_product_pairs:
     print pair



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Statement
» Yield