On Tue, Jun 30, 2020 at 8:55 PM David Lowry-Duda <da...@lowryduda.com>
wrote:

> On the other hand, it seems far more likely to miss keys in a dictionary
> than it is to repeatedly mistake indices in a list.
>

exactly -- dict keys are arbitrary, and it's pretty common to store
"sparse" data by simply leaving out the key if there's nothing interesting
attached to it.

But for Sequences, the only time you get an index error is if you are
indexing beyond the length of the list, and the only case I can think of
for get() would be for a maybe-empty list. otherwise, would I really want
the same thing, and no error, for ANY index larger than the length of the
list?

Rather, if there's a specific index we want, we want it to be there, and if
not, then we are iterating over it, which handles any length (including
zero) just fine.

-CHB



-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EPIN7HNL2KP3HTR4RFXG7EKMA4XN2HR6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to