You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is nice! It does introduce an issue though, __doc__ now contains that text signature in its contents, you'll need to tweak doc to ignore the signature at the start (similar to CPythons _PyType_DocWithoutSignature).
Documentations of methods, types in CPython can have format like below:
<SIGNATURE>
--
<DOCUMENT>
And CPython's __doc__ property strips the signature through _PyType_DocWithoutSignature. Then, when you call <?>.__doc__, you will see only <DOCUMENT>. But RustPython hasn't implemented it so it should be implemented.
Example
Let's see the case of object type.
The full doc is:
PyDoc_STRVAR(object_doc,
"object()\n--\n\n""The base class of the class hierarchy.\n\n""When called, it accepts no arguments and returns a new featureless\n""instance that has no instance attributes and cannot be given any.\n");
As human-familiar:
object()
--
The base class of the class hierarchy.
When called, it accepts no arguments and returns a new featureless
Instance that has no instance attributes and cannot be given any.
And when call print(object.__doc__) in CPython 3.8.0, you will see:
The base class of the class hierarchy.
When called, it accepts no arguments and returns a new featureless
instance that has no instance attributes and cannot be given any.
If this is only adopt to internal doc, we can try to do it better in our derive macros like parsing it from compile time and saving separated variables for __text_signature__ and __doc__
Activity
youknowone commentedon Aug 18, 2021
If this is only adopt to internal doc, we can try to do it better in our derive macros like parsing it from compile time and saving separated variables for
__text_signature__and__doc__youknowone commentedon Jul 6, 2022
now we do this by macro