A Python Data Types Chart for the Forgetful

drewmullen profile image drewmullen ・1 min read

If you're like me, you forget the nuances of each of Python's Data Types. I made this chart as a cheatsheet for myself but I figured I would share it! I will update it with anything I personally find useful! Feel free to comment to add / improve!

Here's to hopefully not needing this chart one day!

Data Type Mutability Iterable Ordered Unique Values Sliceable Instantiate
string immutable s = ""
num immutable i = 0
list mutable x ordered not x L = [], list()
tuple immutable x ordered not x t = (1,), tuple([1,2,3])
range immutable x ordered unique x range(0,3)
dict mutable x unordered unique d={'name': "drew"}, dict(name='drew')
set mutable x unordered unique ms={1,"two"}, set([1,"two",False])
frozenset immutable x unordered unique frozenset([1,"two",False])
bool immutable True, False, bool([])

Posted on by:

drewmullen profile



Full-stack YAML engineer


markdown guide