Spicy Python
a, *rest = [1, 2, 3]
# a = 1, rest = [2, 3]
a, *middle, c = [1, 2, 3, 4]
# a = 1, middle = [2, 3], c = 4
## ignoring a value
a, _, b = (1, 2, 3) # a = 1, b = 3
print(a, b)
## ignoring multiple values
## *(variable) used to assign multiple value to a variable
as list while unpacking
## it's called "Extended Unpacking", only available in
Python 3.x
a, *_, b = (7, 6, 5, 4, 3, 2, 1)
print(a, b)
Create a length-N list of lists
four_lists = [[] for __ in range(4)]
different number systems
million = 100_0_000
print(million)
roles = ["DistributorAdmin", "DistributorUser", "ClientAdmin", "ClientUser"]
simplify_if_else_elif = lambda role: role in roles
role = "ClientUser"
print(simplify_if_else_elif(role))