I don’t like the => syntax for delayed default argument. It looks like a lambda 
and it’s confusing. The @ symbol is more readable. Like this @var=len(a) or 
even var@=len(a). The function decorator changes the behavior of the function. 
Similarly this @ default argument will change the argument value to this 
assignment if a value is not supplied. 
Abdulla

Sent from my iPhone

> On 25 Oct 2021, at 1:03 PM, Chris Angelico <[email protected]> wrote:
> 
> On Mon, Oct 25, 2021 at 7:51 PM Barry Scott <[email protected]> wrote:
>> 
>> Clarification please:
>> 
>> What is the bytecode that will be generated?
> 
> Equivalent to:
> 
> if argument not provided:
>    argument = <expr>
> 
> except that we don't have a way of saying "not provided".
> 
>> Does the bytecode only run the default code if the argument is missing?
> 
> Yes. It is for default values, not for transforming.
> 
>> And missing is not the same as is None?
> 
> Most assuredly not - that's part of the point. The semantics are
> closer to the "dedicated sentinel" idiom, but there is no value which
> can be passed which triggers this.
> 
>> Also have you add the @var=default suggestion from Stephen to the syntax 
>> options.
>> I'm +1 on the @ syntax as it is easier to pick up on and the other reasons 
>> that Stephen
>> provided.
> 
> Not really a fan, but I guess I can add it as an alternative.
> 
> ChrisA
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/[email protected]/message/NLAYWMGR5O27VH4CA4IMFFYPFH4CCFW2/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/D75TVICVVJTIZDWUBGIFZGJ4N2XOVVZW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to