[Python] How do you alias a type in Python?

Discussão em 'Python' iniciado por Stack, Março 31, 2025.

  1. Stack

    Stack Membro Participativo

    In some (mostly functional) languages you can do something like this:

    type row = list(datum)


    or

    type row = [datum]


    So that we can build things like this:

    type row = [datum]
    type table = [row]
    type database = [table]


    Is there a way to do this in Python? You could do it using classes, but Python has quite some functional aspects so I was wondering if it could be done an easier way.

    Continue reading...

Compartilhe esta Página