22.07.19 11:04, Kyle Stanley пише:
Serhiy Storchaka wrote:
Thank you. The majority of the code uses needle on the right. There are just 6 places where it is on the left, and the half of them look copy-pasted, and in one place the C code differs from the corresponding Python implementation. There is an order more places where needle is on the right (and it is always on the right in the Python code). So I prefer to fix these few places to get rid of the minor inconsistency.
If there are only a few places where the needle is on the left and there's not a specific functionality requirement/limitation in those locations which prevent it from being on the right, it's better to have consistency. Is there any particular benefit from having the needle on the left side, or was it just a personal preference from the developer who first implemented the code in those 6 locations?
Seems somebody once wrote the code for list.__contains__, and then it was copied to other places. The code in _asynciomodule.c might be independent, but it is inconsistent with the Python code.