STINNER Victor <vstin...@python.org> added the comment:
> it is more convenient to just call the method Calling a Python method in Python is not convenient nor efficient. For example, PyObject_CallMethod() has to decode a name from UTF-8 and then needs a lookup into the type dictionary. The list.remove() raises a exception if the item is not found, whereas PyCodec_Unregister() does nothing if the codec search function is not found: the exception is ignored. It's also about correctness, looking for an item in a list can be tricky if the list size changes during the lookup, or Python can crash if it uses a borrowed reference whereas a list item is destroyed. There were tons of such bugs in the dict implementation. list.remove() doesn't look safe, but I would prefer to avoid having to fix the same bugs in copies of similar functions. If a public function is not justified, what about an internal function? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41871> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com