Function to avoid a global variable

ast ast at invalid
Tue Apr 28 03:24:29 EDT 2020


Le 28/04/2020 à 09:13, Chris Angelico a écrit :
> On Tue, Apr 28, 2020 at 4:56 PM ast <ast at invalid> wrote:
>>
>> Le 27/04/2020 à 04:46, Bob van der Poel a écrit :


> 
> "Best"? Not sure about that. Functions are first-class objects in
> Python, so a function *is* a callable object. You don't have to create
> a custom class with a call method just to be able to attach attributes
> to your function.
> 
> ChrisA
> 

Using a mutable object as a function default parameter value
and changing it inside the function looks like a "trick"
according to me.


More information about the Python-list mailing list