Counter point, Julia (the language) does just that, reevaluate the default expression if no value is provided, and it is neither slow nor messy.
Admittedly, Julia gets to recompile each function for different arities, which does not fit to pythons execution model. Still, I feel like there is a clean, performant solution for this that the python community could implement. But that would be a breaking change, and that is probably the real reason this well known foot gun is going to stay in the language.
View all comments
Show parent comment
1
u/Bob_Dieter 28d ago
Counter point, Julia (the language) does just that, reevaluate the default expression if no value is provided, and it is neither slow nor messy.
Admittedly, Julia gets to recompile each function for different arities, which does not fit to pythons execution model. Still, I feel like there is a clean, performant solution for this that the python community could implement. But that would be a breaking change, and that is probably the real reason this well known foot gun is going to stay in the language.