Yes, the actual methods written in C have expectations for the parameters they receive and return, but do not have a Python signature.
I’ve never extended or embedded Python with/into C, and have no knowledge of any automated pipeline that you might use to ensure compatibility between headers and macros in your C code and the Python modules that you provide for import into a Python program. I just see the results of pip installing panda3d into a local site-packages/panda3d directory as the file core.sp38-win_amd64.pyd
core.cp38-win_amd64.pyd is a Windows DLL. I’m not familiar with these, so the following is a SWAG. It includes code portions as well as header-like code sufficient to define the signatures. In this file, I see a section of header -like text that defines the interface for each class. Specifically, within the section for class NodePath, I see the following snippet for remove_node:
remove_node(const NodePath self, Thread current_thread)
/**
* Disconnects the referenced node from the scene graph. This will also
* delete the node if there are no other pointers to it.
*
* Normally, this should be called only when you are really done with the
* node. If you want to remove a node from the scene graph but keep it around
* for later, you should probably use detach_node() instead.
*
* In practice, the only difference between remove_node() and detach_node() is
* that remove_node() also resets the NodePath to empty, which will cause the
* node to be deleted immediately if there are no other references. On the
* other hand, detach_node() leaves the NodePath referencing the node, which
* will keep at least one reference to the node for as long as the NodePath
* exists.
*/ C++ Interface:
I also see the text “remove_node” interspersed in binary portions of the .pyd, E.g. the following which might actually be the source of the signature that it understands:
NodePath.remove_node Arguments must match:
remove_node(const NodePath self, Thread current_thread)
I see only one occurrence of the text “removeNode”, in a text portion containing pairs of names “… remove_node removeNode detach_node detachNode reverse_ls reverseLs get_net_state getNetState”. My SWAG is that this section is defining entry point aliases.
I.e. it appears that remove_node, and other pythonic names, have defined signatures in the .pyd file, but the equivalent camelCase names do not – only some type of aliasing to the pythonic names. The above C-like signature for remove_node is presumably correct from the C side of the interface, but is not the correct Python interface.
PyCharm parses and reverse engineers the .pyd into a Python signature for each class. E.g. it understands the above snippet from the NodePath class as:
def remove_node(self, const_NodePath_self, Thread_current_thread): # real signature unknown; restored from __doc__
"""
C++ Interface:
remove_node(const NodePath self, Thread current_thread)
/**
* Disconnects the referenced node from the scene graph. This will also
* delete the node if there are no other pointers to it.
*
* Normally, this should be called only when you are really done with the
* node. If you want to remove a node from the scene graph but keep it around
* for later, you should probably use detach_node() instead.
*
* In practice, the only difference between remove_node() and detach_node() is
* that remove_node() also resets the NodePath to empty, which will cause the
* node to be deleted immediately if there are no other references. On the
* other hand, detach_node() leaves the NodePath referencing the node, which
* will keep at least one reference to the node for as long as the NodePath
* exists.
*/
"""
pass
Although there is no explicit C-like header for removeNode, PyCharm apparently combines the entry-point aliasing to remove_node with the documentation for remove_node. Is cannot be sure about the interface for this name, so it supplies a fits-everything interface. I.e. the signatures for remove_node and removeNode are different because there is no signature for removeNode. This yields the following understanding as it expresses in Python:
def removeNode(self, *args, **kwargs): # real signature unknown
"""
C++ Interface:
remove_node(const NodePath self, Thread current_thread)
/**
* Disconnects the referenced node from the scene graph. This will also
* delete the node if there are no other pointers to it.
*
* Normally, this should be called only when you are really done with the
* node. If you want to remove a node from the scene graph but keep it around
* for later, you should probably use detach_node() instead.
*
* In practice, the only difference between remove_node() and detach_node() is
* that remove_node() also resets the NodePath to empty, which will cause the
* node to be deleted immediately if there are no other references. On the
* other hand, detach_node() leaves the NodePath referencing the node, which
* will keep at least one reference to the node for as long as the NodePath
* exists.
*/
"""
pass
The PyCharm IDE uses the above signatures to support type and parameter checking, as well as providing the developer with a Python code equivalent to the interface and documentation included in the DLL.
In the case of methods like hide() and show(). The pyd. includes
hide(const NodePath self)
hide(const NodePath self, BitMask camera_mask)
/**
* Makes the referenced node (and the entire subgraph below this node)
* invisible to all cameras. It remains part of the scene graph, its bounding
* volume still contributes to its parent's bounding volume, and it will still
* be involved in collision tests.
*
* To undo this, call show().
*/
/**
* Makes the referenced node invisible just to the cameras whose camera_mask
* shares the indicated bits.
*
* This will also hide any nodes below this node in the scene graph, including
* those nodes for which show() has been called, but it will not hide
* descendent nodes for which show_through() has been called.
*/ C++ Interface:
and
NodePath.hide hide() takes 1 or 2 arguments (%d given)
PyCharm understands the signature to be:
def hide(self, const_NodePath_self): # real signature unknown; restored from __doc__
"""
C++ Interface:
hide(const NodePath self)
hide(const NodePath self, BitMask camera_mask)
/**
* Makes the referenced node (and the entire subgraph below this node)
* invisible to all cameras. It remains part of the scene graph, its bounding
* volume still contributes to its parent's bounding volume, and it will still
* be involved in collision tests.
*
* To undo this, call show().
*/
/**
* Makes the referenced node invisible just to the cameras whose camera_mask
* shares the indicated bits.
*
* This will also hide any nodes below this node in the scene graph, including
* those nodes for which show() has been called, but it will not hide
* descendent nodes for which show_through() has been called.
*/
"""
pass
I.e. for remove_node and similar, PyCharm seems to be correctly understanding their (unfortunately incorrect) signatures in the pyd. However, for show and hide, PyCharm is not prepared to integrate the meaning of the multiple signatures and/or “hide() takes 1 or 2 arguments ($d given)”