Avoiding Mutable Default Arguments in Python

Published: 13 November 2018
on channel: 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.


On this page of the site you can watch the video online Avoiding Mutable Default Arguments in Python with a duration of hours minute second in good quality, which was uploaded by the user kishstats 13 November 2018, share the link with friends and acquaintances, this video has already been watched 1,159 times on youtube and it was liked by 21 viewers. Enjoy your viewing!