On 10/24/21 11:22 PM, Steven D'Aprano wrote:
> On Sun, Oct 24, 2021 at 05:40:55PM +0100, Jonathan Fine wrote:

>>      def puzzle(*, a=>b+1, b=>a+1):
>>          return a, b

> We can consider that to be syntactic sugar for:
>
>      def puzzle(*, a=None, b=None):
>          if a is None:
>              a = b+1
>          if b is None:
>              b = a+1
>
> So that has a perfectly sensible interpretation:
>
> - a is optional
> - b is optional
> - but you must supply at least one.
>
> and should be perfectly legal. I see no reason to prohibit it.
>
> (It would be nice if we could give a better exception, rather than just
> UnboundLocalError, but that's not essential.)

+1
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MAUVXBGGSIEW4UGZMUECBVXXY5CZGEQU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to