[Python-ideas] Before and after the colon in funciton defs.
Paul Moore
p.f.moore at gmail.com
Thu Sep 22 21:42:33 CEST 2011
On 22 September 2011 15:34, Paul Moore <p.f.moore at gmail.com> wrote:
> I think that based on your definition, all my "but what about X"
> pathological examples have reasonably sane behaviours (you need a good
> understanding of what "definition time" actually means, but once you
> internalise the fact that def is an executable statement, that isn't
> too hard).
I spotted one that might still be worth mentioning, though.
a = 10
def foo():
a = 20
b = static a
What should that mean? Clearly b isn't 20, as a wasn't set to 20 at
function define time. But b = 10 (on the assumption that "static a"
takes the value of a at define time) will confusing to users, I would
suggest. Not allowed might be best, but I suspect it could be hard to
implement.
But as Guido's -1 on the expression form, this is probably moot.
Paul.
More information about the Python-ideas
mailing list