DEV Community

Discussion on: 5 common mistakes made by beginner Python programmers

Collapse
 
pinotattari profile image
Riccardo Bernardini

Default arguments are evaluated only once.

Ouch! This was quite surprising. It reminds me of old FORTRAN days when you could change the value of a constant. (FORTRAN passes everything by address, this means that if you want to pass a constant to a function, you need to write the constant somewhere and pass the address. If the function changes the parameter, the constant will change.)