I am re-implementing Stirling numbers, so they will become classes (subclasses of Function) instead of python functions as they are today. However, I thought it is a good idea to leave the user the option to use the same class for three different functions - Stirling numbers of the second kind (default), Stirling numbers of the first type which are unsigned (default for this kind) or signed. This is consistent with the current implementation as well.
However, for that I need to allow the user to write something like
stirling(n, k, kind=1)
but that will cause Application to raise
Traceback (most recent call last):
File "<ipython-input-12-f9400eba577d>", line 1, in <module>
stirling(0, 0, kind=1)
File "sympy/core/cache.py", line 91, in wrapper
retval = cfunc(*args, **kwargs)
File "sympy/core/compatibility.py", line 871, in wrapper
result = user_function(*args, **kwds)
File "sympy/core/function.py", line 375, in __new__
result = super(Function, cls).__new__(cls, *args, **options)
File "sympy/core/cache.py", line 91, in wrapper
retval = cfunc(*args, **kwargs)
File "sympy/core/compatibility.py", line 871, in wrapper
result = user_function(*args, **kwds)
File "sympy/core/function.py", line 196, in __new__
raise ValueError("Unknown options: %s" % options)
ValueError: Unknown options: {'kind': 1}
So, unless I am missing something, it looks like the Function class does not support kwargs at all. I can pass these as args, but that's not as nice. What do you think?