On Thu, 8 Nov 2007 18:30:15 -0500, "Prepscius, Colin \(IT\)" <[EMAIL 
PROTECTED]> 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'?

Here's one approach:

    >>> def f():
    ...     x = 10
    ...     def g():
    ...             a = x
    ...     return g
    ...
    >>> f().func_closure
    (<cell at 0xb7d47494: int object at 0x8141d44>,)
    >>>

I don't know what your use-case is, so I have no idea if this is the
kind of solution you're looking for.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to