[Python] Using Python 3.10, but Pylance still says "Alternative syntax for unions requires...

Discussão em 'Python' iniciado por Stack, Agosto 6, 2025.

  1. Stack

    Stack Membro Participativo

    I just upgraded Python to 3.10 for the new features, and when I do import sys; sys.version using the IPython console in VS Code, it prints Python version 3.10.0. But when I open an editor window and try to enter a type annotation using | for sum types, e.g. x:int|float, Pylance highlights the | and says "Alternative syntax for unions requires Python 3.10 or newer."

    Any thoughts?

    Continue reading...

Compartilhe esta Página