Ever had a Python function behave strangely, remembering values between calls when it shouldn’t? You’re not alone! This is one of Python’s sneakiest pitfalls—mutable default parameters. Recently someone asked for help in our Pybites Circle Community with a Bite exercise that seemed to be behaving unexpectedly. It turned out that this was a result of modifying a mutable parameter… Continue reading The Mutable Trap: Avoiding Unintended Side Effects in Python
Articles on mutable default arguments
Write more maintainable Python code, avoid these 15 code smells
By PyBites Team on 15 September 2023
This week we talk about code smells. 💡 Listen here: Also available on our YouTube channel: Code smells are characteristics in the code that might indicate deeper issues or potential problems. While they’re not necessarily bugs, they can be a sign of poor code quality or maintainability issues. 😱 We distilled 15 common smells ranging… Continue reading Write more maintainable Python code, avoid these 15 code smells