Skip to content

Instantly share code, notes, and snippets.

@eclecticmiraclecat
Created June 28, 2021 07:34
Show Gist options
  • Save eclecticmiraclecat/c28e65b9aa60454363866f9bc8a1e89d to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/c28e65b9aa60454363866f9bc8a1e89d to your computer and use it in GitHub Desktop.
In [1]: def hi(): 
   ...:     yield 'jack' 
   ...:     yield 'bob' 
   ...: 
  
In [2]: hi()                                                                    
Out[2]: <generator object hi at 0x7ff64a27c0b0>

In [11]: h = hi()                                                               

In [12]: next(h)                                                                
Out[12]: 'jack'

In [13]: next(h)                                                                
Out[13]: 'bob'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment