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

Jim Jewett jimjjewett at gmail.com
Thu Sep 22 18:16:27 CEST 2011


On Thu, Sep 22, 2011 at 3:47 AM, Ron Adam <ron3200 at gmail.com> wrote:

> As an expression, the only thing that matters is that the names used in
> the expression, are findable at define time.

Not just that the names are findable, but that they are already bound
to something.

    def f(a):
        b=a
        static c=b

should fail, and should probably be a syntax error to prevent it
apparently working (but perhaps with the wrong value) when (and only
when) a more global b was set earlier.

> No assignment is needed.

Agreed; in particular, static imports should reduce the cost of
importing from inside a function body.  (But then will people
effectively start spelling "import" as "static import" even at the top
of a module?)

-jJ



More information about the Python-ideas mailing list