[issue35262] There should be a list.get just like dict.get

2018-11-16 Thread Abram Clark
Abram Clark added the comment: There really are valid use cases for this. Would you please refer me to this previous discussion? In a particular small to medium sized Python repository of ~10k lines, list get is used 23 times, whereas other list builtin methods are used far less (for example

[issue35262] There should be a list.get just like dict.get

2018-11-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: This idea has been discussed before and was rejected. While get() makes sense and has valid use cases for dictionaries which use key based lookups, there isn't a parallel for lists. In general, we do just fine without list.get(). Also, it seems that o

[issue35262] There should be a list.get just like dict.get

2018-11-15 Thread Abram Clark
New submission from Abram Clark : Just like with dictionaries, it is convenient to index lists without catching exceptions. Adding an import for this most basic functionality is slightly tedious, and I can't imagine it would break anything to add a list.get method. -- messages: 329978