[Python] Another way to pass parameters in python functools partial

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

  1. Stack

    Stack Membro Participativo

    I want to pass a global variables to a method using the Functools library in Python.

    My Code :

    app.add_routes([
    web.post('/register',
    partial(register, user_register_info=user_register_info, email=email, username=username, number=number, pwd=reg_pwd, confirm_pwd=confirm_pwd, fullname=fullname)
    )
    ])


    But the way I wrote it is too long. Can I write it shorter? for example:

    app.add_routes([
    web.post('/register',
    partial(register, user_register_info, email, username, number, pwd, confirm_pwd, fullname)
    )
    ])


    Or even another way?

    Continue reading...

Compartilhe esta Página