Created
March 18, 2016 07:51
-
-
Save eugeneai/3c9ed5689ea8b6bc415f to your computer and use it in GitHub Desktop.
Генераторы
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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