[Python] How to understand this code all(y for y in [1,0]) [duplicate]

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

  1. Stack

    Stack Membro Participativo

    Since all() only takes one parameter, this code all(1,0) apparently does not work. But why does the following work?

    all(y for y in [1,0])


    Is this because an implicit tuple or list is triggered as the parameter of the function? If so, where is the reference in the documentation? Thank you!

    Continue reading...

Compartilhe esta Página