Tag

mutable default arguments

1 views collected around this technical thread.

Python Programming Learning Circle
Python Programming Learning Circle
Sep 24, 2022 · Fundamentals

Common Python Pitfalls: Dynamic Typing, Mutable Default Arguments, Scope, and List Modification

This article examines several confusing behaviors in Python—including implicit variable declarations, mutable default arguments, class variable inheritance, scope rules, and list‑modification during iteration—illustrating each with code examples and offering practical solutions for developers.

Dynamic TypingPythonScope
0 likes · 9 min read
Common Python Pitfalls: Dynamic Typing, Mutable Default Arguments, Scope, and List Modification
Python Programming Learning Circle
Python Programming Learning Circle
May 28, 2021 · Fundamentals

Common Python Pitfalls and How to Avoid Them

This article enumerates frequent Python pitfalls—including UnboundLocalError, mutable default arguments, subtle differences between x+=y and x=x+y, tuple syntax, shared mutable containers, list mutation during iteration, closure late binding, misuse of del, import inconsistencies, version‑specific changes, and the GIL—providing explanations and correct practices to help developers write safer code.

@ImportClosuresCommon Pitfalls
0 likes · 13 min read
Common Python Pitfalls and How to Avoid Them