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
In my project, certain classes have a strange result for the class initializer documentation. For example:
AdoptionData.__init__ does have its own docstring, and it does not say "call self as function".
The classes that show this behavior all share a common trait: they have the same metaclass, and that metaclass overrides __call__. (The metaclass implements memo-izing/instance caching.)
I am sure that the metaclass is the reason for this behavior, but I haven't quite figured out exactly how this is happening. I can see that the overridden __call__ function might be problematic -- no telling what will happen when you invoke the classname as a function! But I hope there is some way to override this behavior and get it to use my docstring anyway?
Steps to reproduce the behavior:
I'll create a minimal reproduction if needed, but I'm guessing the description is enough?
System Information
Paste the output of "pdoc --version" here: v9.0.1
The text was updated successfully, but these errors were encountered:
Thanks, this was useful feedback! We take Metaclass.__call__ into account for special snowflakes like dataclasses and NamedTuples. If the class itself has an __init__ with docstring, we should of course prefer that. Fixed with 64aab58. 😃
Problem Description
In my project, certain classes have a strange result for the class initializer documentation. For example:
AdoptionData.__init__
does have its own docstring, and it does not say "call self as function".The classes that show this behavior all share a common trait: they have the same metaclass, and that metaclass overrides
__call__
. (The metaclass implements memo-izing/instance caching.)I am sure that the metaclass is the reason for this behavior, but I haven't quite figured out exactly how this is happening. I can see that the overridden
__call__
function might be problematic -- no telling what will happen when you invoke the classname as a function! But I hope there is some way to override this behavior and get it to use my docstring anyway?Steps to reproduce the behavior:
I'll create a minimal reproduction if needed, but I'm guessing the description is enough?
System Information
Paste the output of "pdoc --version" here: v9.0.1
The text was updated successfully, but these errors were encountered: