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

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

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Mon Mar 8 15:35:13 EST 2004


From: Skip Montanaro

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.

You could create some lovely obfuscated code ...

def decorator (func): return 1

def func [decorator] (a, b): return 2

print func(3, 4)

... TypeError

:)

BTW, I have to say that looking at it, I don't like the decorator before the arguments. I'm immediately trying to read it as:

func (decorator) ...

It's something I think I could eventually get used to, but I don't find it very readable. I guess there's not enough languages that do something like that.

Tim Delaney



More information about the Python-Dev mailing list