[Python-Dev] Re: PEP 318 restrictions on elements (original) (raw)

[Python-Dev] Re: PEP 318 - generality of list; restrictions on elements

Paul Moore pf_moore at yahoo.co.uk
Mon Mar 8 15:50:38 EST 2004


Skip Montanaro <skip at pobox.com> writes:

>> What are the restrictions on list items? >> >> Only a function? >> Only a code object? (I assume so) >> Must the code return the original function? >> Must the code return a code object?

Phillip> Any callable object. May return anything. Must take a single argument, which itself must be a callable, right?

I work from the equivalence of

def f [a, b, c] (args):
    ...

and

def f(args):
    ...
f = a(f)
f = b(f)
f = c(f)

Hence, all wrappers will be called with a single argument. That argument may not be a callable (if a returns a non-callable, that's what b will get) and the return value need not be a callable. Such uses could be considered strange, however...

Paul.

This signature intentionally left blank



More information about the Python-Dev mailing list