Skip to content

Deprecations #26

@ecomodeller

Description

@ecomodeller

Image

https://docs.python.org/3/library/warnings.html#warnings.deprecated
Added in version 3.13: See PEP 702.

from warnings import deprecated

@deprecated("Use the new way instead")
def the_old_way():
    print("God dag!")


def main():
    print("Hello from foo!")


if __name__ == "__main__":
    main()
    the_old_way()
$ uv run mypy main.py --enable-error-code=deprecated
main.py:15: error: function main.the_old_way is deprecated: Use the new way instead  [deprecated]
Found 1 error in 1 file (checked 1 source file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions