Input: ``` from typing import Union def test1_func(arg: Union[None, str, int]) -> None: return ``` Resulting documentation: `def test1_func(arg: Union[ForwardRef(None), str, int]) ‑> None` Expected documentation: `def test1_func(arg: Union[None, str, int]) ‑> None` !pdoc --version pdoc 0.10.0
Activity
hhoppe commentedon Apr 26, 2022
Actually, it would be even better (clearer and more concise) if this produced the Python 3.10 syntax:
def test1_func(arg: str | int | None) ‑> None
It seems that
pdoc
does so some of the time -- maybe only forOptional[simple_type]
?hhoppe commentedon Nov 26, 2024
Maybe an option to output
int | float | None
rather thanOptional[int | float]
?It seems to be the modern trend.
REF: Format Optional as `X | None`
kernc commentedon Nov 26, 2024
No options—sane defaults. Thanks!
ENH: Improve formatting of Optional, Union and collection.abc types