Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using None to index all elements
You have a function that takes an argument, this argument is the index of the last element you want to show from an
array. At some point you want found out that you want to use this function but grab all elements. Just pass None.
def some_function(last_idx):
some_arr = range(100)
last_idx = 5
last_idx = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment