In last week’s Pylance update we introduced Semantic colorization, and thank you for all feedback! It was exciting for the team to bring this new feature to you. With the latest release of Pylance (version 2020.9.4) we are excited to introduce features that bring us closer to the goal of helping developers write correct Python code faster and more easily.

1.     Support for recursive type aliases

With recursive types aliases, you can now specify types for complex scenarios in a natural, succinct, and intuitive manner. For example, expressing a structure to capture my settings for VSCode can be as simple and elegant as in the example below. For data structures that have a tree pattern, a recursive type alias offers a neat solution.

ConfigValue = Union[
    bool, 
    str, 
    float,
    List["ConfigValue"],
    Dict[str, "ConfigValue"],
]
config: List[ConfigValue] = [
    {"python.experiments.optInto":        
        ["Experiment1", "Experiment13", "Experiment56", "Experiment106"]},
    {"python.formatting.provider": "black"},
    {"python.formatting.blackArgs": ["--line-length", "130"]},
    {"python.sortImports.args": ["-rc", "-sp isort.cfg"]},
]

#python

Pylance introduces five new features that enable type magic for Python developers
2.15 GEEK