This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, shihai1991, vstinner
Date 2020-10-01.10:45:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601549143.68.0.476978985633.issue41871@roundup.psfhosted.org>
In-reply-to
Content
> 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?
History
Date User Action Args
2020-10-01 10:45:43vstinnersetrecipients: + vstinner, serhiy.storchaka, shihai1991
2020-10-01 10:45:43vstinnersetmessageid: <1601549143.68.0.476978985633.issue41871@roundup.psfhosted.org>
2020-10-01 10:45:43vstinnerlinkissue41871 messages
2020-10-01 10:45:43vstinnercreate