[Python] Is there a method to check Generic Type on instancing time in pyhon?

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I suppose how it can be check what type specified on Generic types in __init__ ?

    On python 3.10, it could not be.

    On first, I found this page: Instantiate a type that is a TypeVar

    and make some utility for get __orig_class__.

    And test on instancing time, there is no __orig_class__ attribute in that timing on self.

    Then I searched again I found this issue page: https://github.com/python/typing/issues/658.

    I recognized that any python might have this limit.

    Is there any other way?

    Continue reading...

Compartilhe esta Página