Decorator for very-variadic functions
variadic is a Python (2.7+ and 3.4+) function decorator to write variadic functions accepting a mix of arguments and iterables of those arguments. Oh, and they keep their argspec, so tools doing introspection (Sphinx doc, IDEs, etc.) will work well. No ugly f(*args, **kwds) in your doc!
Note that PEP 448 makes variadic obsolete: if you’re using Python 3.5+, you should keep plain variadic functions and call them with several argument unpackings.
Questions? Remarks? Bugs? Want to contribute? Open an issue!
Install from PyPI:
$ pip install variadic
>>> from variadic import variadic
Define a function:
>>> @variadic(int) ... def f(*args): ... return args >>> f(1, 2, [3, 4], xrange(5, 8)) (1, 2, 3, 4, 5, 6, 7)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size variadic-0.1.4.tar.gz (5.8 kB)||File type Source||Python version None||Upload date||Hashes View|