Skip to content

Instantly share code, notes, and snippets.

@beyoung
Created April 14, 2015 02:10
Show Gist options
  • Save beyoung/fb3fd151854e7b57401a to your computer and use it in GitHub Desktop.
Save beyoung/fb3fd151854e7b57401a to your computer and use it in GitHub Desktop.
python yield comprehension
A=[1,2,3,4,5]
def K():
while 1 in A:
print 'begin'
yield A[0]
print A.pop()
print 'end'
for i in K():
print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment