Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obriencj/a32ad3de87487e4ee731625633f35aa0 to your computer and use it in GitHub Desktop.
Save obriencj/a32ad3de87487e4ee731625633f35aa0 to your computer and use it in GitHub Desktop.
=== Sample2 class code ===
Name: Sample
Filename: build_class.py
Argument count: 0
Kw-only arguments: 0
Number of locals: 0
Stack size: 4
Flags: 0x0
Constants:
0: 'sample_2.<locals>.Sample'
1: None
2: <code object __init__ at 0x10686ac00, file "build_class.py", line 12>
3: 'sample_2.<locals>.Sample.__init__'
4: (None,)
Names:
0: __name__
1: __module__
2: __qualname__
3: __init__
4: __classcell__
Cell variables:
0: __class__
Disassembly:
11 0 LOAD_NAME 0 (__name__)
2 STORE_NAME 1 (__module__)
4 LOAD_CONST 0 ('sample_2.<locals>.Sample')
6 STORE_NAME 2 (__qualname__)
12 8 LOAD_CONST 4 ((None,))
10 LOAD_CLOSURE 0 (__class__)
12 BUILD_TUPLE 1
14 LOAD_CONST 2 (<code object __init__ at 0x10686ac00, file "build_class.py", line 12>)
16 LOAD_CONST 3 ('sample_2.<locals>.Sample.__init__')
18 MAKE_FUNCTION 9
20 STORE_NAME 3 (__init__)
22 LOAD_CLOSURE 0 (__class__)
24 DUP_TOP
26 STORE_NAME 4 (__classcell__)
28 RETURN_VALUE
=== Sample2 init code ===
Name: __init__
Filename: build_class.py
Argument count: 2
Kw-only arguments: 0
Number of locals: 2
Stack size: 2
Flags: OPTIMIZED, NEWLOCALS, NESTED
Constants:
0: None
Names:
0: super
1: __init__
2: value
Variable names:
0: self
1: val
Free variables:
0: __class__
Disassembly:
13 0 LOAD_GLOBAL 0 (super)
2 CALL_FUNCTION 0
4 LOAD_ATTR 1 (__init__)
6 LOAD_FAST 0 (self)
8 CALL_FUNCTION 1
10 POP_TOP
14 12 LOAD_FAST 1 (val)
14 LOAD_FAST 0 (self)
16 STORE_ATTR 2 (value)
18 LOAD_CONST 0 (None)
20 RETURN_VALUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment