Message377744
> 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? |
|
Date |
User |
Action |
Args |
2020-10-01 10:45:43 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka, shihai1991 |
2020-10-01 10:45:43 | vstinner | set | messageid: <1601549143.68.0.476978985633.issue41871@roundup.psfhosted.org> |
2020-10-01 10:45:43 | vstinner | link | issue41871 messages |
2020-10-01 10:45:43 | vstinner | create | |
|