Refs #25629 -- Added arity class attribute to Func expressions

This commit is contained in:
Sergey Fedoseev 2015-10-31 15:01:08 +05:00 committed by Claude Paroz
parent 03c6ad7ad4
commit 0a26121797
6 changed files with 27 additions and 10 deletions

View file

@ -252,6 +252,15 @@ The ``Func`` API is as follows:
A class attribute that denotes the character used to join the list of
``expressions`` together. Defaults to ``', '``.
.. attribute:: arity
.. versionadded:: 1.10
A class attribute that denotes the number of arguments the function
accepts. If this attribute is set and the function is called with a
different number of expressions, ``TypeError`` will be raised. Defaults
to ``None``.
The ``*expressions`` argument is a list of positional expressions that the
function will be applied to. The expressions will be converted to strings,
joined together with ``arg_joiner``, and then interpolated into the ``template``