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

Terry Reedy tjreedy at udel.edu
Fri Sep 23 23:32:21 CEST 2011

On 9/22/2011 9:11 PM, Nick Coghlan wrote:

>      def f(x, _i=i):  # pydoc would, by default, display the signature as 'f(x)'
>          return x + _i

I presume you meant  def f(x, *, _i=i): return x+_i so that _i will be 
keyword only.

> Keyword-only arguments in Py3k already help with this approach to the
> question, especially when the 'hidden' keyword is prefixed with an
> underscore to indicate it isn't meant for public consumption.

It certainly makes it impossible to 'accidentally' override with an 
extra positional parameter.

Terry Jan Reedy

More information about the Python-ideas mailing list