Skip to content

Commit 580947d

Browse files
committed
Criado e removido atributo dinamico de objeto do tipo Pessoa
1 parent 85be1e7 commit 580947d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

OO/pessoa.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ def cumprimentar(self):
1818
print(andre.nome)
1919
print(andre.idade)
2020
for filho in andre.filhos:
21-
print(filho.nome)
21+
print(filho.nome)
22+
andre.sobrenome = 'Ramalho' #criação de atributo dinamico fazendo atribuição
23+
del andre.filhos #contrário dessa operação com del
24+
print(andre.__dict__) #os atributos de instancia ficam presentes no atributo especial dunder dict
25+
print(renzo.__dict__)

0 commit comments

Comments
 (0)