[Python-ideas] parameter omit

Aaron Brady castironpi at comcast.net
Fri May 11 07:22:55 CEST 2007


> -----Original Message-----
> From: Steven Bethard [mailto:steven.bethard at gmail.com]
> Sent: Friday, May 11, 2007 12:13 AM
> 
> On 5/10/07, Aaron Brady <castironpi at comcast.net> wrote:
> > The old ways:
> >
> > [code to assign my_b and my_c]
> > if use_default_b and use_defualt_c:
> >         foo(a)
> > elif use_default_b:
> >         foo(a, c=my_c)
> > elif use_default_c:
> >         foo(a, my_b)
> [snip]
> > The new way:
> >
> > my_b, my_c= paramdefault, paramdefault
> > [code to assign my_b and my_c]
> > foo(a, my_b, my_c)
> 
> As another poster mentioned, the normal way to write this is::
> 
>     kwargs = {}
>     if use_default_b:
>         kwargs['b'] = my_b
>     if use_default_c:
>         kwargs['c'] = my_c
>     foo(a, **kwargs)
> 
> It is so extremely uncommon to need to do such a thing that I'm firmly
> against adding any additional syntax. Syntax should only be introduced
> for common things that many people need.
> 
> STeVe

Mr. Bethard, I am not adding syntax.  Don't put words in my mouth.  This is
another one- observe the subject line.  Tell me you always make a call with
the same parameters, every time you make the call.  My thinking can't be
that backwards.  A use case could take some time, but sure.

> > Cobol is another way to do it, so be careful with acronyms.
> > No new syntax in this one.
> > 
> > The old ways: ...




More information about the Python-ideas mailing list