Created
April 17, 2022 14:51
-
-
Save autf/eb1a0d2b6d9291b13881810e84e18163 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
import dis | |
import rich # not in std | |
class Foo: | |
@staticmethod | |
def bar(co): | |
rich.inspect(co) | |
for c in co.co_consts: | |
if hasattr(c, 'co_code'): | |
Foo.bar(c) | |
co = compile(open(__file__).read(), __file__, 'exec') | |
Foo.bar(co) | |
# dis.dis(co) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment