Created
October 5, 2015 21:27
-
-
Save DmitrySoshnikov/8dce08cf1790391570b5 to your computer and use it in GitHub Desktop.
Python: compiled code sharing between several functions
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
# Compiled code sharing between | |
# several functions. | |
arr = [] | |
for k in [1, 2, 3]: | |
arr.append(lambda: k) | |
print(arr[0].__code__ == arr[1].__code__) # True | |
print(arr[0].__code__.co_code) # bytecode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment