[Python-ideas] Tweaking closures and lexical scoping to include the function being defined
Nick Coghlan
ncoghlan at gmail.com
Fri Sep 30 20:14:35 CEST 2011
On Fri, Sep 30, 2011 at 1:39 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> This is a possible solution: a syntax requirement that no real
> decorators come after this new syntax. I'm still cautious about the
> idea of sharing syntax between compile-time and def-time directives.
> However, default arguments sort of do this already.
All name binding operations have both compile time and runtime
semantics, so that's OK. 'nonlocal' and 'global' are actually the odd
ones out since they *only* affect compile time and don't actually
correspond directly to anything in the generated bytecode (instead
influencing the way the names they specify get treated in other parts
of the code).
If a "function state decorator" approach is used, then yeah, I agree
it should come immediately before the main part of the function
header. However, I'm not seeing a lot to recommend that kind of syntax
over the post-arguments '[]' approach.
Regards,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list