Oren Milman <ore...@gmail.com> added the comment:

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.

----------
nosy: +Oren Milman

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue28280>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to