![]() |
Cell objects and their values
Say I obtain a cell object via:
>>> def f(): .... y = 3 .... def g(): .... return y .... return g .... >>> f().func_closure[0] <cell at 0x011787F0: int object at 0x002F9320> Is there a way to get the value of the int (f.y) which is referenced by the cell, without inspecting (or even having a reference to) f? That is, using only the object "g()" and its attributes, I'd like to obtain the same value for LOAD_DEREF that the interpreter does; in the same way that I can access g.func_globals, I'd like something similar to "g.func_cellvars" (not just the names as in g.func_code.co_cellvars, but the values)... Robert Brewer MIS Amor Ministries fumanchu@amor.org |
| All times are GMT. The time now is 05:48 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.