Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rajmayank/428eca4b0af537442d342a77729db22c to your computer and use it in GitHub Desktop.
Save rajmayank/428eca4b0af537442d342a77729db22c to your computer and use it in GitHub Desktop.
Python-Generators-API-Introduction-II
import sys
secretV1 = doSecretStuffVersion1(5)
secretV2 = doSecretStuffVersion2(5)
print(secretV1). # 12593025435840...
print(type(secretV1)) # <class 'int'>
print(secretV2) # <generator object doSecretStuffVersion2 at 0x10ca5ab30>
print(type(secretV2)) # <class 'generator'>
print(sys.getsizeof(secretV1)) # 9312
print(sys.getsizeof(secretV2)) # 112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment