[Python] How to find the expected number of parameter for unknown class instantiation...

Discussão em 'Python' iniciado por Stack, Fevereiro 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have the type of an unknown class stored in a variable

    a_type = UnknownType


    I want to know how many parameters are expected by this type to be instantiated.

    something like this:

    expected_number_of_arg = nb_args(a_type)
    # where expected_number_of_args = 0 if a_type can be instantiated like this a_type()


    Is this possible in python?

    Continue reading...

Compartilhe esta Página