Very simple proposal.
E.g.
```
>>> l = [‘a’, ‘b’]
>>> l.get(0)
‘a’
>>> l.get(2)
None
>>> l.pop(1, default=‘c’)
‘b’
>>> l.pop(1, default=‘c’)
‘c'
```
Essentially to match them to those of a dict.
Current workarounds:
```
try:
a = b[n]
except IndexError:
a = default
# and
l[index] if -len(l) <= index < len(l) else default
```
Benefits:
1. Convenience
2. Easy to remember API methods for anyone used to a dict
3. Speed improvements given it’s implemented in C
4. Time saving!
It took me around 7seconds to type 2nd snippet without auto-complete.
So following Chris’ logic...
If there are 10,000,000 python users on Stack…
And we assume, that every user encounters such need at least 2 times a year (being very speculative here, would say conservative?).
Saving on typing and correcting above snippet is 5sec (conservative here?).
That’s ~600 days of pure code writing time saved every year.
In 100 years, which python will obviously survive - that’s ~16.5 years of pure code typing time saved worldwide!