¡@

Home 

python Programming Glossary: foo.__code__.co_consts

Accessing class variables from a list comprehension in the class definition

http://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition

class body itself code objects have a co_consts structure foo.__code__.co_consts None code object Foo at 0x10a436030 file stdin line 2 'Foo'.. object Foo at 0x10a436030 file stdin line 2 'Foo' dis.dis foo.__code__.co_consts 1 2 0 LOAD_FAST 0 __locals__ 3 STORE_LOCALS 4 LOAD_NAME 0.. code object shows that x is indeed loaded as a global foo.__code__.co_consts 1 .co_consts 'foo. locals .Foo' 5 code object listcomp at 0x10a385420..

Assign Many Variables at Once, Python

http://stackoverflow.com/questions/18661879/assign-many-variables-at-once-python

tuple constant def foo ... a b c 'yyy' 'yyy' 'yyy' ... foo.__code__.co_consts None 'yyy' 'yyy' 'yyy' 'yyy' def bar ... a b c 'yyy' ... bar.__code__.co_consts..