On Sun, Oct 24, 2021 at 05:24:46PM +0400, Abdulla Al Kathiri wrote: > It’s not a good idea to use a mutable object anyways a default value.
Unless you intend to use a mutable object as a default value, and have it persist from one call to the next. Then it is absolutely fine. One of the use-cases for late-binding is that it will allow a safe and obvious way to get a *new* mutable default each time you call the function: def func(arg, @more=[]) would give you a new empty list each time you call func(x), rather than the same list each time. -- Steve _______________________________________________ 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/OEJ2YDVEOHQYMUQEG34JYWWLAF7IK2VF/ Code of Conduct: http://python.org/psf/codeofconduct/