[Python] Setting multiple object attributes at once

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a way to set multiple attributes of the same object on a single line, similarly to the way one assigns values to multiple variables?

    If I can write

    a,b,c=1,2,3


    I would like to have something like

    someObject.(a,b,c)=1,2,3


    Having the same effect as

    someObject.a=1
    someObject.b=2
    someObject.c=3

    Continue reading...

Compartilhe esta Página