Add `get`as a method to list and tuple

June 5, 2021
11:23 a.m.
The get method exists for dict, which is very useful. I like it very much, i would like it to be added as a method to list and tuple. The syntax would be similar to dict.get, except you provide an index like 0 or 1 instead of a key. It would look like this: ```py fruits = [“apples”, “bananas”] fruits.get(0) # would return “apples” fruits.get(2) # would return None or the default value if passed ``` Thank you for reading this idea.
1383
Age (days ago)
1383
Last active (days ago)
0 comments
1 participants
participants (1)
-
svrchn921@outlook.com