469,602 Members | 2,143 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

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
fu******@amor.org

Jul 18 '05 #1
0 860

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jan Decaluwe | last post: by
49 posts views Thread by Steven Bethard | last post: by
1 post views Thread by James | last post: by
3 posts views Thread by David Whitney | last post: by
161 posts views Thread by KraftDiner | last post: by
19 posts views Thread by Daniel Pitts | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.