Skip to content

Instantly share code, notes, and snippets.

@alexandre
Created July 12, 2014 20:36
Show Gist options
  • Select an option

  • Save alexandre/2f9f92199310d851844c to your computer and use it in GitHub Desktop.

Select an option

Save alexandre/2f9f92199310d851844c to your computer and use it in GitHub Desktop.
exemplo de substituição de instruções de controle (if, else) por expressões booleanas.
# Versão utilizando if/else
if x == 10:
fun_add(x)
else:
fun_del(x)
# utilizando expressões booleanas apenas...
(x == 10 and fun_add(x)) or (fun_del(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment