[Python] Type hint for "can be compared" objects

Discussão em 'Python' iniciado por Stack, Abril 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am writing several functions that handle ordered datasets. Sometime, there is an argument that can be a int or float or a timestamp or anything that supports comparison (larger than / smaller than) and that I can use for trimming data for instance.

    Is there a way to type-hint such a parameter? The typing module doesn't seem to include this, but is there some other way?

    Continue reading...

Compartilhe esta Página