Skip to content

Instantly share code, notes, and snippets.

@eugeneai
Created March 18, 2016 07:51
Show Gist options
  • Save eugeneai/3c9ed5689ea8b6bc415f to your computer and use it in GitHub Desktop.
Save eugeneai/3c9ed5689ea8b6bc415f to your computer and use it in GitHub Desktop.
Генераторы
def _(f,*args):
yield f
for a in args:
if type(a)==str:
yield a
else:
# yield from a
for b in a:
yield b
for a in _('f',_('g','a','c'),'b'):
print (a)
def gen(x):
while True:
yield x
x+1
for b in gen(10):
print (b)
if b>10:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment