Python guides
Every published Python guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Python guides
Most readLatest Python guides
Page 144 of 179How to Create a Python Empty Set
Learn the correct way to create a Python empty set, why {} creates an empty dictionary, and how to use empty sets effectively in real code.
Python Set Initialization: Syntax, Methods, and Pitfalls
Learn the correct ways to initialize sets in Python: literals, the set() constructor, comprehensions, empty sets, and common pitfalls to avoid.
Python Set Declaration: Syntax and Pitfalls
python set declaration: Learn how to declare sets in Python, including literals, the set() constructor, and the empty-set gotcha that confuses many developers.
Python Set: Operations, Performance, and Use Cases
python set: Learn how Python sets store unique elements, perform union and intersection operations, and provide fast membership testing for practical data tasks.
Python Multiple Return Values: Tuples, Namedtuples, and Dataclasses
python multiple return values: Learn how to return multiple values from a Python function using tuples, namedtuples, dataclasses, and other containers, with practical...
Python Tuple Return Values: Syntax and Unpacking
Learn how to return tuples from Python functions, unpack them into separate variables, and choose between tuples, named tuples, and dataclasses.
Python namedtuple Usage: Practical Examples
python namedtuple usage: Learn how to use Python's namedtuple to create readable, lightweight data structures, including syntax, defaults, performance, and when to pre...
Python Namedtuple: Lightweight, Readable Data Containers
python namedtuple: Learn how Python's namedtuple creates lightweight immutable data containers, when to use them over dictionaries or classes, and their performance tr...
Python Nested Tuples: Syntax, Access, and Use Cases
Learn how to create and access nested tuples in Python, understand their immutability, and see when nested tuples are a better choice than lists, namedtuples, or dataclasses.
Python Tuple as Dictionary Key: How and Why
python tuple as dictionary key: Learn how to use Python tuples as dictionary keys, why they work, common pitfalls, and when to choose alternatives like dataclasses.