Skip to content

[PyYAML] Use Incomplete instead of Any - #16197

Open
donbarbos wants to merge 1 commit into
python:mainfrom
donbarbos:pyyaml-use-incomplete
Open

[PyYAML] Use Incomplete instead of Any#16197
donbarbos wants to merge 1 commit into
python:mainfrom
donbarbos:pyyaml-use-incomplete

Conversation

@donbarbos

Copy link
Copy Markdown
Contributor

In some places, Any was intended to represent a Python object corresponding to a YAML value.
I think we could be more precise than simply using Any here for example, by defining a TypeAlias for the possible types (list, dict, etc.) and adding a comment explaining the choice.

@srittau

srittau commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

In some places, Any was intended to represent a Python object corresponding to a YAML value.
I think we could be more precise than simply using Any here for example, by defining a TypeAlias for the possible types (list, dict, etc.) and adding a comment explaining the choice.

In general a type alias would also double as documentation and would make the comment for Any superfluous. But we probably need to distinguish between output types (= Any) and input types (= X | Y) for the usual union in output types problem.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants