Avoiding Mutable Default Arguments in Python

Publié le: 13 novembre 2018
sur la chaîne: 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.


Sur cette page du site, vous pouvez voir la vidéo en ligne Avoiding Mutable Default Arguments in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur kishstats 13 novembre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,159 fois et il a aimé 21 téléspectateurs. Bon visionnage!