rcurry and similar functions do not work with methods of built-in types
>>> has_suffix = rcurry(str.endswith)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\funcy\funcs.py", line 57, in rcurry
n = get_spec(func).max_n
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\funcy\_inspect.py", line 108, in get_spec
mod = func.__module__
AttributeError: 'method_descriptor' object has no attribute '__module__'. Did you mean: '__reduce__'?```
I'll take a look
Ok, rcurry() and friends behave the same in Python 3.8 and 3.10. And it doesn't work with str.endswith indeed.
funcy fails to introspect methods of builtin types.
The workaround for now is:
has_suffix = rcurry(str.endswith, 2)
Also, str.endswith actually have 4 params, so your example won't work anyway.
Updated docs and readme to recommend specifying n. The issue itself is frozen for now, since I don't see much value in doing proper introspection here.
Note that as a last resort funcy goes to inspect.signature(), which might work or not for the same thing depending on Python version.