Tagged articles
3 articles
Page 1 of 1
Code Mala Tang
Code Mala Tang
Jun 8, 2025 · Fundamentals

Why Python’s a, b = b, a Isn’t Magic – The Real Mechanics Explained

This article demystifies Python’s a, b = b, a idiom by detailing how tuple packing and unpacking work, the exact evaluation order, the CPython bytecode implementation, comparisons with C, C++, Java, JavaScript, and the performance and memory implications of the technique.

Pythonbytecodetuple unpacking
0 likes · 17 min read
Why Python’s a, b = b, a Isn’t Magic – The Real Mechanics Explained
Python Programming Learning Circle
Python Programming Learning Circle
Aug 6, 2024 · Fundamentals

Four Time‑Saving Python Tricks to Boost Execution Speed

This article presents four practical Python performance tricks—including list reversal with slicing versus reverse(), one‑line variable swapping, moving loops inside functions, and reducing function calls—each demonstrated with code examples and timing results that show measurable speed improvements.

Loop Optimizationlist reversaloptimization
0 likes · 5 min read
Four Time‑Saving Python Tricks to Boost Execution Speed
Liangxu Linux
Liangxu Linux
Aug 22, 2021 · Fundamentals

Swap Variables Without a Temp: The XOR Trick Explained

This article introduces the XOR (exclusive OR) operation, explains binary representation of numbers, demonstrates how XOR can swap two integer values without a temporary variable, and provides a concise C code example illustrating the technique.

bitwisevariable swapxor
0 likes · 4 min read
Swap Variables Without a Temp: The XOR Trick Explained