John Hunter <jdhunter@...5...> writes:
You shouldn't need to with the ft2font extension code, because it uses
pycxx which has support for kwarg handling. Eg in the _image.cpp src
Py::Object resize(const Py::Tuple& args, const Py::Dict& kwargs);
int norm = 1;
if ( kwargs.hasKey("norm") ) norm = Py::Int( kwargs["norm"] );
This seems to mean that the function cannot be called using the normal
Traceback (most recent call last):
File "<stdin>", line 1, in ?
IndexError: Unexpected SeqBase<T> length.
Instead you have to do img.resize(10,10,norm=1). This is handled
transparently by PyArg_ParseTupleAndKeywords: if you set the format
string to "ii|ii" and list the names of all parameters as keywords,
you automatically get the normal Python convention where the last two
args are optional and all args are specifiable with their names.
But I guess this is not so important in extension code that only gets
called by matplotlib internals and not end users, so I changed
load_char to use the pycxx convention.