By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,001 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,001 IT Pros & Developers. It's quick & easy.

Cell objects and their values

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.