[Python-ideas] Before and after the colon in funciton defs.

David Townshend aquavitae69 at gmail.com
Mon Sep 19 14:19:54 CEST 2011

I agree, both are ugly (btw, mine wasn't a proposal, just an
illustration that it is possible with the status quo).

One question I have is would the locals be local to a specific call or
the the function object? I don't know enough about the python language
internals to know the correct terminology to explain what I mean, but
from a users point of view, would the locals be reset at every call?
The fact that they are locals implies that they don't exist outside a
function call, but assigning them in the function definition implies
that they exist within the function object in a similar way to the
value of keyword arguments.


On Mon, Sep 19, 2011 at 11:35 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Mon, Sep 19, 2011 at 5:44 PM, David Townshend <aquavitae69 at gmail.com> wrote:
>> I think something similar could be achieved with annotations, as in
>> the following example.
>> This is incomplete, and probably full of errors, but it gives the idea.
> Proposals that are uglier than the default argument hack itself (and I
> put both annotations+decorator and the '@+' idea in that category)
> just aren't worth the hassle. The *only* change even potentially worth
> making in this area would be one that:
> - looks good (i.e. is easy to read)
> - is easy to remember and write
> - doesn't hurt call time performance
> - addresses all the default argument hack use cases
> - doesn't have the downside of altering the function's externally
> visible signature
> My initialised locals idea *might* qualify (although I've yet to see
> anyone make a serious attempt at poking holes in it, so I'm not
> convinced of that), but the other suggestions in this thread haven't
> really offered anything to recommend them over the existing approach.
> Cheers,
> Nick.
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list