[issue35262] There should be a list.get just like dict.get
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 nosy: Abram Clark priority: normal severity: normal status: open title: There should be a list.get just like dict.get type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue35262> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35262] There should be a list.get just like dict.get
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 list.pop is used once, though dict.pop is used 18 times). I would be happy to go into specific examples. -- ___ Python tracker <https://bugs.python.org/issue35262> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17191] pdb list shows unexpected code when stack frame includes a try / finally block
New submission from Abram Clark: The list command in pdb shows an unexpected portion of code after an up command enters a try / finally block in the call stack. To reproduce: pdb pdb_list_bug_reproduce.py c up list Expected behavior: Show 11 lines around line 8, "throw_something()", which was the entry point to the lower stack frame. Actual behavior: Shows code centered around line 10, in the finally block, which is likely cleanup code that has nothing to do with the exception thrown. -- files: pdb_list_bug_reproduce.py messages: 181951 nosy: Abram.Clark priority: normal severity: normal status: open title: pdb list shows unexpected code when stack frame includes a try / finally block type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file29047/pdb_list_bug_reproduce.py ___ Python tracker <http://bugs.python.org/issue17191> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com