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

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

Skip Montanaro skip at pobox.com
Mon Mar 8 15:46:37 EST 2004


>> 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.

aahz> No, that's not right.  If

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

aahz> is valid, this must also always be valid:

aahz>     def foo() [w2]: pass

Can you explain why this must be the case? I agree that coupling between w1 and w2 should be discouraged (see my ast example).

aahz> I'm not sure to what extent we can/should enforce this, but I'm -1
aahz> on any proposal for which this isn't the documented behavior.

I guess this is an area where PEP 318 should be fleshed out a bit. I don't see any reason it shouldn't be expanded to include semantics as well as syntax. That might require a title change, but I don't think the semantics should be left unspecified, nor do I think the syntax and semantics should reside in separate PEPs.

Skip



More information about the Python-Dev mailing list