<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Mar 10, 2017 02:42, "Terry Reedy" <<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 3/2/2017 3:03 AM, Serhiy Storchaka wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Function implemented in Python can have optional parameters with default<br>
value. It also can accept arbitrary number of positional and keyword<br>
arguments if use var-positional or var-keyword parameters (*args and<br>
**kwargs).<br>
</blockquote>
<br></div>
In other words, Python signature possibilities are already unusually complex.<div class="quoted-text"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But there is no way to declare an optional parameter that<br>
don't have default value.<br>
</blockquote></div>
... [moving the following up]<div class="quoted-text"><br>
> I propose to add a new syntax for optional parameters. If the argument<br>
> corresponding to the optional parameter without default value is not<br>
> specified, the parameter takes no value.<br>
<br></div>
-1<br>
<br>
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.<br>
<br>
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.)<div class="quoted-text"></div></blockquote></div></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">-1 also</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br></div></blockquote></div></div></div>