[Python-ideas] Before and after the colon in funciton defs.
ron3200 at gmail.com
Fri Sep 16 23:30:47 CEST 2011
(This idea may have been suggested before, because it seems too obvious
How about if we remove the requirement that the colon be on the same
line as the function name.
And, what if the colon is then used to split the difference between the
definition time, and call time code in function definitions. So that
every thing before the colon is done at definition time. Everything
after the colon is done at call time.
""" doc string """
Then could become ...
""" doc string """ # foo.__doc__ = """ doc string """
I think this represents what is actually happening a bit better.
One possibility for define time code is to have decorators listed that
read in the order they are applied instead of bottom up.
""" function to be decorated. """
@deco1 # foo = deco1(foo) The '@' notation still works.
@deco2 # foo = deco2(foo)
Note, that putting the doc string after the decorators may be better as
it would put the doc string on the decorated function instead of the
I think there may be more things possible with this idea than the simple
More information about the Python-ideas