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

Aahz aahz at pythoncraft.com
Mon Mar 8 15:32:13 EST 2004


On Mon, Mar 08, 2004, Fred L. Drake, Jr. wrote:
> On Monday 08 March 2004 03:05 pm, Skip Montanaro wrote:
>>
>> Must take a single argument, which itself must be a callable, right?
> 
> If I write:
> 
>     def foo() [w1, w2]:
>         pass
> 
> I'd expect w2() to be passed whatever w1() returns, regardless of
> whether it's callable.  It should raise an exception if it gets
> something it can't handle.

No, that's not right.  If

    def foo() [w1, w2]: pass

is valid, this must also always be valid:

    def foo() [w2]: pass

I'm not sure to what extent we can/should enforce this, but I'm -1 on
any proposal for which this isn't the documented behavior.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Do not taunt happy fun for loops. Do not change lists you are looping over."
--Remco Gerlich, comp.lang.python



More information about the Python-Dev mailing list