Created
September 16, 2012 20:22
-
-
Save ErinCall/3734233 to your computer and use it in GitHub Desktop.
This file contains 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 do_something(): | |
... print 'here' | |
... for x in xrange(0, 8): | |
... yield x | |
... | |
>>> do_something() | |
<generator object do_something at 0x100428aa0> | |
>>> foo = do_something() | |
>>> foo | |
<generator object do_something at 0x100428b40> | |
>>> dir(foo) | |
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__iter__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'close', 'gi_code', 'gi_frame', 'gi_running', 'next', 'send', 'throw'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment