1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Type hint for "hashable"

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    Sometimes an argument to a function I write can be of any type as long as it is a hashable - for instance, because my function adds it to a set or uses it as a dictionary key.

    Is there a way to type-hint this fact using the PEP 484 type hints introduced in Python 3.5? The typing module doesn't seem to include a hashable type, but is there some other way?

    Continue reading...

Compartilhe esta Página