Tagged articles
3 articles
Page 1 of 1
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.

Class VariablesPythondynamic typing
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.

GILImportVersion Compatibility
0 likes · 13 min read
Common Python Pitfalls and How to Avoid Them
MaGe Linux Operations
MaGe Linux Operations
Oct 12, 2017 · Fundamentals

10 Common Python Pitfalls Every Developer Should Avoid

This article defines what constitutes a Python trap and walks through ten classic pitfalls—including mutable default arguments, the subtle differences between x+=y and x=x+y, tuple syntax quirks, list-of-lists initialization, modifying lists during iteration, late-binding closures, __del__ garbage‑collection issues, import inconsistencies, Python 2‑to‑3 changes, and the infamous GIL—providing clear examples and best‑practice solutions.

Pitfallsmutable-default-argumentspython2to3
0 likes · 12 min read
10 Common Python Pitfalls Every Developer Should Avoid