3 ms·
>"You can use it to cache values between function calls:" and I really hope nobody does that. That default parameter is a mutable global variable and languages
by imtringued 2mo ago
>"You can use it to cache values between function calls:" and I really hope nobody does that.
That default parameter is a mutable global variable and languages like Rust have effectively banned mutable statics for good reasons that I personally am discovering myself by messing around with UnsafeCell inside statics and even I personally am starting to think that mutable statics are at best a necessary evil, but not one you want to rely on as your go to solution.
- frollogaston 2mo agoI'm not concerned about the global. The problem is it's global but doesn't look like it, or looks like a mistake. You want a global cache in Python, there are easy and much better ways.