[Python-ideas] Before and after the colon in funciton defs.
Nick Coghlan
ncoghlan at gmail.com
Thu Sep 22 06:40:33 CEST 2011
On Thu, Sep 22, 2011 at 2:21 PM, Carl Matthew Johnson
<cmjohnson.mailinglist at gmail.com> wrote:
> Presumably static would work the same way? Still, I find this sort of distasteful, since the behavior is a bit surprising to those not familiar with the in's and out's of the compilation model.
There's a reason style guides say not to do that with global and
nonlocal, even though the language technically allows it. Definition
time variable declarations would work the same way.
> Why not put the static declaration in the argument list, something like:
>
> def f(static l=[]):
For all the same reasons people don't like the 'after **' and '[] in
the function header' suggestions. Most notably, the fact that the
evaluation of certain expressions at definition time is an
implementation detail rather than part of the public API, so it
doesn't really belong in the header.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list