Skip to content

Start using | instead of Union or Optional when typing #5945

Closed
@Illviljan

Description

@Illviljan

Is your feature request related to a problem? Please describe.
To make it easier reading the typing it is now possible to use | instead of Union or Optional.

Here's an example how it looks like in pandas:
https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/_core.py#L116-L134

Describe the solution you'd like
Replace for example:

  • Union[str, int] with str | int
  • Optional[str] with None | str

This would likely require adding from __future__ import annotations at the top of the file.

References
https://www.python.org/dev/peps/pep-0604/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions