[Python-ideas] Short form for keyword arguments and dicts

Ron Adam ron3200 at gmail.com
Wed Jun 26 16:59:54 CEST 2013



On 06/26/2013 02:48 AM, Greg Ewing wrote:
> Ron Adam wrote:
>> And I don't like the '=' with nothing on the right.
>
> Expanding on the suggestion someone made of having a
> single marker of some kind in the argument list, I
> came up with this:
>
>      def __init__(self, text, font = system_font, style = 'plain'):
>         default_size = calc_button_size(text, font, style)
>         Widget.__init__(self, size = default_size, pass font, style)


Using the '*' in the call sites as suggested earlier because of it's 
consistency with function definitions is probably a better choice.

In the above example, would the '*' (or pass) be in the same place as the 
it is in the function definition?

      Widget.__init__(self, *, size=default_size, font, style)

Or:

      Widget.__init__(self, size=default_size, *, font, style)


I think it should, because then there would be a clearer separation between 
what are positional and keyword arguments throughout a program.


_Ron



More information about the Python-ideas mailing list