Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aliases for parameterized types of standard collections #363

Closed
hriebl opened this issue Mar 12, 2022 · 2 comments
Closed

Aliases for parameterized types of standard collections #363

hriebl opened this issue Mar 12, 2022 · 2 comments

Comments

@hriebl
Copy link

hriebl commented Mar 12, 2022

Since Python 3.9, the standard collections work as generics. I sometimes like to create aliases for parameterized types of standard collections to facilitate typing other objects. Unfortunately, the output of pdoc is very verbose in this case. It's much more sparse if I use the "old" generics from the typing module. See the following example:

from typing import Dict

FirstDict = dict[str, str]
"""Shows as a class in pdoc with all methods of a dictionary."""

SecondDict = Dict[str, str]
"""Shows as a variable in pdoc with no methods."""

Is there a way to make pdoc render the version with the dict just as the version with the Dict?

By the way, thank you for reviving pdoc! 🌹

@mhils
Copy link
Member

mhils commented Mar 13, 2022

Thanks for pointing this out! dict[str, str] should of course behave as you describe, I fixed this on main. :)

@hriebl
Copy link
Author

hriebl commented Mar 14, 2022

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants