MaGe Linux Operations
MaGe Linux Operations
Jun 3, 2019 · Fundamentals

7 Common Python Pitfalls Explained with Code Examples

This article walks through seven tricky Python snippets—default mutable arguments, lambda closures, class variable inheritance, division differences between Python 2 and 3, out‑of‑range slicing, list multiplication side effects, selective list comprehensions, and custom dict subclasses—explaining their outputs and how to fix them.

Class Variablesclosuresdefault-arguments
0 likes · 12 min read
7 Common Python Pitfalls Explained with Code Examples
MaGe Linux Operations
MaGe Linux Operations
Dec 26, 2017 · Fundamentals

Common Python Gotchas: Default Arguments, Closures, Class Variables & Division Explained

This article walks through several puzzling Python code snippets, explaining why default mutable arguments share state, how closures suffer from late binding, the inheritance of class variables, differences in division between Python 2 and 3, list slicing quirks, and how list multiplication creates shared references, while also offering corrected implementations.

Class VariablesPythonclosures
0 likes · 12 min read
Common Python Gotchas: Default Arguments, Closures, Class Variables & Division Explained
MaGe Linux Operations
MaGe Linux Operations
Mar 2, 2017 · Fundamentals

What Changed in Python 3.0? Key Differences and Migration Tips

This article explains the major changes introduced in Python 3.0—including the new print() function, unified Unicode strings, altered division behavior, updated exception syntax, removal of xrange, revised literal formats, module renames, and data‑type updates—while offering guidance for migrating existing Python 2 code.

ExceptionsPython 3Unicode
0 likes · 10 min read
What Changed in Python 3.0? Key Differences and Migration Tips