Add spaces around "=" in signature repr.

PEP8 indicates (correctly, IMO) that when an annotation is present, the
signature should include spaces around the equal sign, i.e.

    def f(x: int = 1): ...

instead of

    def f(x: int=1): ...

(in the latter case the equal appears to bind to the type, not to the
argument).

pybind11 signatures always includes a type annotation so we can always
add the spaces.
This commit is contained in:
Antony Lee
2017-11-26 20:00:35 -08:00
committed by Jason Rhinelander
parent d1db2ccfdf
commit 0826b3c106
3 changed files with 10 additions and 10 deletions

View File

@@ -238,7 +238,7 @@ protected:
} else if (c == '}') {
// Write default value if available.
if (arg_index < rec->args.size() && rec->args[arg_index].descr) {
signature += "=";
signature += " = ";
signature += rec->args[arg_index].descr;
}
arg_index++;