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

Skip Montanaro skip at pobox.com
Mon Mar 8 15:27:54 EST 2004


    Fred> On Monday 08 March 2004 03:05 pm, Skip Montanaro wrote:

    >> Must take a single argument, which itself must be a callable, right?

    Fred> If I write:

    Fred>     def foo() [w1, w2]:
    Fred>         pass

    Fred> I'd expect w2() to be passed whatever w1() returns, regardless of
    Fred> whether it's callable.  It should raise an exception if it gets
    Fred> something it can't handle.

Yes.  I was thinking of the case where we wanted it to return something
useful which could be bound to the name "foo".  I suppose if you've had too
much caffeine you could dream up a case where w1() returns an AST based on
the original foo and w2() does something with it to cook up a new object,
but I suspect that would be pretty rare.

Skip



More information about the Python-Dev mailing list