On Apr 16, 2020, at 10:20, Calvin Spealman <cspea...@redhat.com> wrote:
> 
> I could absolutely see a lot of use for this when it comes to rebinding names 
> in callbacks and the like.
> 
> for i in range(10):
>   callLater(delay, lambda i=: print(i))

But that one wouldn’t be handled by the proposal. It’s explicitly only allowing 
the name= syntax on arguments in a call, not on parameters in a (lambda or def) 
definition.

And if you expanded the proposal to include both your feature and the one in 
the proposal, it might read ambiguously, or at least confusingly:

    callLater(lambda i=: I, delay=)

Can you tell that one is passing a keyword argument while the other is stashing 
a default value for a positional-or-keyword parameter, without having to stop 
and think through the parse? (Even with added parens somewhere?) Maybe with 
enough familiarity, it wouldn’t be a problem. But maybe that in itself enough 
reason to just include one or the other new feature, wait until people are 
familiar with it, and then see if the new one looks confusing or not?

(That’s assuming we’re eventually likely to implement both of these, when it’s 
not actually clear many people want either one of them…)

_______________________________________________
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/BNKWXSU2IYEA3B5XIRI2VV4RUTEBLOMP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to