◐ Shell
clean mode source ↗

Message 303340 - Python tracker

I would be happy to write a PR that implements that.

However, i am not sure which way is better to construct a list from the return
value (an iterable, hopefully) of keys() etc.:
- Call PyList_Type() (in each of PyMapping_Keys() etc.) on the iterable, and
  overwrite the error message in case it is a TypeError.
- Write a helper function iterable_as_list(), which uses PyObject_GetIter() and
  PySequence_List(), and call it in each of PyMapping_Keys() etc..
  (iterable_as_list() would receive "keys" etc., so that it would raise the
  appropriate error message, in case of a TypeError.)

ISTM that the first one is simpler, but I am not sure about the performance
difference between them.