What type hint should I use for "some container type" in general but explicitly exclude the str type?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/learnpython

Our great sponsors
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • SaaSHub - Software Alternatives and Reviews
  • typing

    Python static typing home. Contains the source for typing_extensions and the documentation. Also hosts a user help forum.

    See https://github.com/python/typing/issues/256 for a discussion.

  • pydantic

    Data parsing and validation using Python type hints

    Indeed. Currently, Python type hinting cannot exclude types, and, of course, does not enforce anything at runtime anyway - although a library like pydantic can be used to enforce them at runtime (hence its popularity with packages like FastAPI).

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts