News for hackers. Stuff that matters.
Re:What's New in Python 3.12 by thatxliner on Wednesday October 18, 2023 @04:46PM (#37934542)
“The new syntax allows declaring TypeVarTuple and ParamSpec parameters, as well as TypeVar parameters with bounds or constraints:”

    ```
    ...
    type IntOrStrSequence[T: (int, str)] = Sequence[T]  # TypeVar with constraints
    ```

Why can’t the syntax be

    ```
    type IntOrStrSequence[T: int | str] = Sequence[T]
    ```
Re:What's New in Python 3.12 by bayangan on Wednesday October 18, 2023 @07:22PM (#37936140)
I think because that conflicts with the `bound` syntax which expects a single type.
Re:What's New in Python 3.12 by thatxliner on Wednesday October 18, 2023 @08:50PM (#37936858)
Unless I’m mistaken, bound constrains the type to a specific protocol while this constrains the type to specific types.