On Mar 10, 2017 02:42, "Terry Reedy" <tjre...@udel.edu> wrote:

On 3/2/2017 3:03 AM, Serhiy Storchaka wrote:

> Function implemented in Python can have optional parameters with default
> value. It also can accept arbitrary number of positional and keyword
> arguments if use var-positional or var-keyword parameters (*args and
> **kwargs).
>

In other words, Python signature possibilities are already unusually
complex.


But there is no way to declare an optional parameter that
> don't have default value.
>
... [moving the following up]

> I propose to add a new syntax for optional parameters. If the argument
> corresponding to the optional parameter without default value is not
> specified, the parameter takes no value.

-1

Being able to do this would violate what I believe is the fundamental
precondition for python-coded function bodies: all parameters are bound to
an object (so that using a parameter name is never a NameError); all
arguments are used exactly once in the binding process; the binding is done
without ambiguity (or resort to disambiguation rules).  Calls that prevent
establishment of this precondition result in an exception.

This precondition is normal in computing languages.  I believe that all of
the ~20 languages I have used over decades have had it.  In any case, I
believe it is important in understanding Python signatures and calls, and
that there would need to be a strong reason to alter this precondition.
(Stronger than I judge the one given here to be.)


-1 also

Having used a language extensively that does not enforce this precondition
(MATLAB), I agree that not being able count on arguments existing makes
handing function arguments much more difficult.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to