The file is generated by SWIG. The function definitions are indeed 'dead code', in that you can remove the function definition altogether and just leave the assignment in place.
Because the code is autogenerated, the code is somewhat inefficient. The SWIG function that generates this code, states:
if (Getattr(n, "feature:python:callback") || !have_addtofunc(n)) {
/* If there is no addtofunc directive then just assign from the extension module (for speed up) */
Printv(f_dest, name, " = ", module, ".", name, "\n", NIL);
}
so the second assignment is there to just replace the generated Python function to speed up usage.
If the function has additional Python code to add when generating (have_addtofunc()
is true when there is a docstring, a prepend or an append value) then the replacement line isn't generated.
Presumably the original function is left in place so that auto-completion tools can make use of the function signature.