Creating a cell 'by hand'

Duncan Booth duncan.booth at invalid.invalid
Fri Nov 9 03:49:29 EST 2007


"Prepscius, Colin \(IT\)" <Colin.Prepscius at morganstanley.com> wrote:

> The last argument to new.function takes a closure, which is a tuple of
> cell objects.  Does anybody know how to create those cell objects 'by
> hand'?
> 

>>> def newcell():
	def f(): cell
	return f.func_closure[0]
	cell = None

>>> newcell()
<cell at 0x00C5DAB0: empty>

Hmm, looks like there's a bug here:

>>> cell.cell_contents

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in <module>
    cell.cell_contents
SystemError: error return without exception set
>>> 



More information about the Python-list mailing list