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

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

Aahz aahz at pythoncraft.com
Mon Mar 8 16:00:01 EST 2004


On Mon, Mar 08, 2004, Skip Montanaro wrote:

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

Principle of least surprise, essentially. There are already going to be enough obscure uses for this; let's try to keep the completely whacky out of it. You'll have to come up with an awfully convincing use case to change my mind.

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