Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostrar a "pegadinha" de if a or b in iterável #33

Open
ayharano opened this issue Mar 31, 2024 · 1 comment
Open

Mostrar a "pegadinha" de if a or b in iterável #33

ayharano opened this issue Mar 31, 2024 · 1 comment

Comments

@ayharano
Copy link

A construção if a or b in iterável soa como válida, mas muita gente não sabe sobre precedência de operadores

Se a e b forem hasheáveis, minha recomendação padrão é if {a, b}.intersection(iterável)

Algo que eu acho interessante de set.intersection e outros métodos é que pode ser qualquer iterável, não necessariamente um outro set ou frozenset

@bugelseif
Copy link
Member

code 23 | commit e2bdbe4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants