> On 1 Dec 2021, at 17:59, Chris Angelico <ros...@gmail.com> wrote:
>
> On Thu, Dec 2, 2021 at 4:40 AM Barry Scott <ba...@barrys-emacs.org> wrote:
>>
>> On 1 Dec 2021, at 06:16, Chris Angelico <ros...@gmail.com> wrote:
>> 3) If "yes" to question 1, would you use it for any/all of (a) mutable
>> defaults, (b) referencing things that might have changed, (c)
>> referencing other arguments, (d) something else?
>>
>>
>> yes (a)
>> What does (b) mean? example please.
>> yes (c)
>>
>
> global_default = 500
> def do_thing(timeout=>global_default): ...
>
> If the global_default timeout changes between function definition and
> call, omitting timeout will use the updated global.
>
> Similarly, you could say "file=>sys.stdout" and if code elsewhere
> changes sys.stdout, you'll use that.
On a case-by-case basis I might still put defaulting into the body
of the function if that made the intent clearer.
I could see me using @file=sys.stdout.
Barry
>
> ChrisA
> _______________________________________________
> 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/KVLO3CEXBJUKBUJPJZIJM54U6S5PIFKM/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
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/IZIGDOR2NE2N774SJ4PZ4L7IOWVTUDKF/
Code of Conduct: http://python.org/psf/codeofconduct/