Teach ghostwriter.equivalent
to handle positional-only params by position, not name
#2855
Labels
enhancement
it's not broken, but we want it to be better
Consider the following example:
This is kinda silly: the Ghostwriter treats
math.gcd(x, y, /)
as if the argument names are meaningful! We wanted:The solution is going to involve expanding
_make_equiv_body
. Rough notes: get given_args in _make_equiv_body; use write_call with passed variable names for posonly arguments; prefer pos-or-kw names then kwonly names then pos-only names as successive fallbacks. very rough start: master...Zac-HD:hypothesis:posonly-eqiv-ghostwriterOther ideas: sort equivalent funcs by qualname, for stable output under shouldn't-matter changes of ordering; use module name instead of index to distinguish function results; add a did-you-mean if one func is actually a module (or look up matching functions on it? also works for two modules...).
The text was updated successfully, but these errors were encountered: