Skip to content

Instantly share code, notes, and snippets.

@dunossauro
Created July 13, 2019 03:44
Show Gist options
  • Save dunossauro/75bf3cb742b93557e21ef82ccc3cdd76 to your computer and use it in GitHub Desktop.
Save dunossauro/75bf3cb742b93557e21ef82ccc3cdd76 to your computer and use it in GitHub Desktop.
Rapidinha pythonica 8 - https://youtu.be/FAoMykdLkNs
t1 = ('Eduardo', 'Mendes', 25)
# desempacotamos em variáveis
nome, sobre, idade = t1
t2 = (('Eduardo', 'Mendes'), 25)
# desempacotamos em variáveis compostas
(nome, sobre), idade = t2
l1 = ['Eduardo', 25, 'Martha', 'Cesar']
nome, idade, mae, pai = l1
nome, idade, *pais = l1
*user, pai, mae = l1
pai, mae = mae, pai
def xpto(a, b, c):
return a, b, c
xpto(1, 2, 3)
(1, 2, 3)
xpto(*l3)
('a', 'b', 'c')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment