Avoiding Mutable Default Arguments in Python

Pubblicato il: 13 novembre 2018
sul canale di: kishstats
1,159
21

From "The Hitchhiker's Guide to Python"
https://docs.python-guide.org/writing...

Default argument value is mutable.

Default argument values are `evaluated only once at function definition time`, which means that modifying the default value of the argument will affect all subsequent calls of the function.

IDE's like PyCharm will show warnings when attempting a mutable default argument.


In questa pagina del sito puoi guardare il video online Avoiding Mutable Default Arguments in Python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato kishstats 13 novembre 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,159 volte e gli è piaciuto 21 spettatori. Buona visione!