[Python-ideas] Optional parameters without default value

Sven R. Kunze srkunze at mail.de
Fri Mar 3 14:10:06 EST 2017


On 03.03.2017 16:24, Yury Selivanov wrote:
> TBH I think that optional parameters isn't a problem requiring new
> syntax. We probably do need syntax for positional-only arguments
> (since we already have  them in a way), but optional parameters
> can be solved easily without a new syntax.
>
> Syntax like:
>
> 1. def a(?foo),
> 2. def a(foo=pass),
> 3. def a([foo]),
>
> will complicate the language too much IMO.
>
> Yury

I never really encountered a real-world use where I would have needed 
this kind of parameter declaration ability.

It's like the ++ operator of C which comes in pre- and postfix notation.
It's really cool to teach the nuances of it. And to create exam 
questions using it. And to confuse students. But completely unnecessary 
in real-life code.

Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170303/a71469f8/attachment.html>


More information about the Python-ideas mailing list