Browse by Topic

Popular

Latest

Latest Python Posts

Illustration showing a tuple being split into fixed first and last elements with a starred middle section in Python
Python

Python Starred Tuple Unpacking: Syntax and Use Cases

Learn how Python's starred tuple unpacking uses the * operator to assign values, handle variable-length sequences, and avoid common errors.

Pythontuple unpackingstarred expressionsiterable unpacking
Illustration of Python iterable unpacking with a star expression splitting a list into separate parts.
Python

Python Extended Iterable Unpacking in Practice

python extended iterable unpacking: Learn how Python's extended iterable unpacking works, including star expressions, nested unpacking, and common pitfalls.

pythoniterable unpackingstar expressionstuple unpacking
Illustration of a tuple being unpacked into separate variables, shown as colored blocks flowing from one container into several.
Python

Python Tuple Unpacking: Syntax and Patterns

Learn how Python tuple unpacking works: basic syntax, extended unpacking with *, practical patterns, edge cases, and when a named structure is clearer.

tuple unpackingpython syntaxdestructuringpython data structures
Illustration of Python tuple packing showing comma-separated values being collected into a tuple container.
Python

Python Tuple Packing: Syntax, Behavior, and Use Cases

python tuple packing: Learn how Python tuple packing works in assignments, function returns, and value swaps, with edge cases and runtime behavior explained.

pythontuplemultiple assignmentunpacking
Illustration of a single-element tuple with a trailing comma in Python code, highlighting the correct syntax.
Python

Python Single Element Tuple: Syntax and Pitfalls

python single element tuple: Learn how to create a single-element tuple in Python, why the trailing comma is essential, and common mistakes to avoid.

pythontuplesyntaxdata-structures
Illustration of Python tuple initialization showing parentheses and comma syntax for single-element tuple.
Python

Python Tuple Initialization: Syntax and Common Patterns

Learn how to initialize tuples in Python, including empty tuples, single-element tuples, and tuples created from iterables, with practical examples and common pitfalls.

tuplespython syntaxdata structuresimmutable data
Illustration of a Python tuple declaration with parentheses and a trailing comma
Python

Python Tuple Declaration: Syntax and Type Hints

Learn how to declare tuples in Python, including parentheses, trailing commas, type hints, immutability, and common pitfalls.

PythonTuplesData StructuresType Hints
Illustration of a Python tuple as an immutable container with fixed elements.
Python

Python Tuple: Immutable Sequences and When to Use Them

Understand Python tuples: immutable sequences, packing/unpacking, memory efficiency, and when to choose tuples over lists.

PythonTuplesImmutabilityData Structures
Illustration of Python list mutability showing two variables referencing the same list and one mutation affecting both.
Python

Python List Mutability: Assignment and Function Calls

python list mutability: Learn how Python list mutability affects assignment, function calls, and copying, and avoid common pitfalls like shared references and mutable...

list mutabilitypython referencesfunction argumentscopying lists
Illustration comparing Python list and set structures, showing an ordered list with duplicates and an unordered set with unique elements.
Python

Python List vs Set: Choosing the Right Data Structure

python list vs set: Compare Python lists and sets: order, duplicates, membership testing performance, memory overhead, and when to choose each.

PythonData StructuresPerformanceSet Operations