Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Cell objects and their values (http://www.velocityreviews.com/forums/t330137-cell-objects-and-their-values.html)

Robert Brewer 04-21-2004 11:06 PM

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 02:53 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.