[Python-ideas] parameter omit
Aaron Brady
castironpi at comcast.net
Fri May 11 08:33:25 CEST 2007
> -----Original Message-----
> From: Talin [mailto:talin at acm.org]
> Sent: Friday, May 11, 2007 1:25 AM
>
> Aaron Brady wrote:
> [snip]
> Non-sequitur? How does that relate to what I said?
>
> Let me state in different words what others have already stated: There
> are already ways to accomplish most what you are trying to do.
>
> In Python, any argument will have its default value if you omit it from
> the argument list when calling the function. There's no need to
> explicitly tell it to use the default value, it just does this naturally.
>
> Now, the only case where this might be a problem is a fairly rare and
> odd case where you are specifying arguments positionally and not by
> keyword, where you want to specify the value of argument N+1 but want
> argument N to be its default.
>
> But the language should not make a special cases to support this
> particular case, for 3 reasons:
>
> 1) The case is rare.
>
> 2) There are easy ways around it: Simply supply the value of argument
> N+1 by keyword instead of by position.
>
> 3) If your function has lots of positional arguments, each of which has
> a different meaning, then your function probably needs to be refactored
> anyway. Using keywords is much safer in such cases, and if you use
> keywords, then the whole problem you raise goes away.
>
> -- Talin
Alert me if my post [Brady 01:25 U.S. Central] doesn't illuminate your
concerns, and I will treat them.
More information about the Python-ideas
mailing list