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.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Q4ST3IF2YXR4FTB73V545NQBKHRB6RHX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to