You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code in similarity.py uses some out of date Python constructions and would be IMO clearer and easier to maintain if it was updated.
Looking through the code for match_edge while reviewing #5516 I saw some rewrites that could take advantage of current Python features. For example, there are many list functions calls which should be made into list comprehensions. Similarly the zip(range(m), g_ind) and similar structures should either use enumerate or avoid indexing completely. e.g. for g in g_ind instead of for i, g in zip(range(m), g_ind). Furthermore, the match_edge function (and likely others) would be easier to read IMO if we handled the case of an empty matched_uv up front. That case falls through the logic, executing various else clauses when we know what will happen to it. And there should be no default value on the keyword argument matched_uv.
The text was updated successfully, but these errors were encountered:
The code in
similarity.py
uses some out of date Python constructions and would be IMO clearer and easier to maintain if it was updated.Looking through the code for
match_edge
while reviewing #5516 I saw some rewrites that could take advantage of current Python features. For example, there are manylist
functions calls which should be made into list comprehensions. Similarly thezip(range(m), g_ind)
and similar structures should either useenumerate
or avoid indexing completely. e.g.for g in g_ind
instead offor i, g in zip(range(m), g_ind)
. Furthermore, thematch_edge
function (and likely others) would be easier to read IMO if we handled the case of an emptymatched_uv
up front. That case falls through the logic, executing variouselse
clauses when we know what will happen to it. And there should be no default value on the keyword argumentmatched_uv
.The text was updated successfully, but these errors were encountered: