Python - POO

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/3

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:43 AM on 3/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

4 Terms

1
New cards

oi

def meu_repr(self):
    class_name = self.__class__.__name__
    class_dict = self.__dict__
    return f"{class_name}({class_dict})"

def adiciona_repr(cls):   # recebe a CLASSE
    cls.__repr__ = meu_repr  # adiciona/sobrescreve o dunder method
    return cls                # retorna a classe modificada

@adiciona_repr
class Pessoa:
    def __init__(self, nome):
        self.nome = nome

p1 = Pessoa("Joaquim")
print(p1)  # Saída: Pessoa({'nome': 'Joaquim'})

2
New cards

ggf

def meu_repr(self):
    class_name = self.__class__.__name__
    class_dict = self.__dict__
    return f"{class_name}({class_dict})"

def adiciona_repr(cls):   # recebe a CLASSE
    cls.__repr__ = meu_repr  # adiciona/sobrescreve o dunder method
    return cls                # retorna a classe modificada

@adiciona_repr
class Pessoa:
    def __init__(self, nome):
        self.nome = nome

p1 = Pessoa("Joaquim")
print(p1)  # Saída: Pessoa({'nome': 'Joaquim'})

3
New cards

dsds

def meu_repr(self):
    class_name = self.__class__.__name__
    class_dict = self.__dict__
    return f"{class_name}({class_dict})"

def adiciona_repr(cls):   # recebe a CLASSE
    cls.__repr__ = meu_repr  # adiciona/sobrescreve o dunder method
    return cls                # retorna a classe modificada

@adiciona_repr
class Pessoa:
    def __init__(self, nome):
        self.nome = nome

p1 = Pessoa("Joaquim")
print(p1)  # Saída: Pessoa({'nome': 'Joaquim'})

4
New cards

dsds

def meu_repr(self):
    class_name = self.__class__.__name__
    class_dict = self.__dict__
    return f"{class_name}({class_dict})"

def adiciona_repr(cls):   # recebe a CLASSE
    cls.__repr__ = meu_repr  # adiciona/sobrescreve o dunder method
    return cls                # retorna a classe modificada

@adiciona_repr
class Pessoa:
    def __init__(self, nome):
        self.nome = nome

p1 = Pessoa("Joaquim")
print(p1)  # Saída: Pessoa({'nome': 'Joaquim'})

Explore top notes

note
Verbs and Verb Tenses
Updated 1160d ago
0.0(0)
note
3.1 Intro to Culture
Updated 122d ago
0.0(0)
note
AP Statistics Unit 3 Notes
Updated 330d ago
0.0(0)
note
Plant Kingdom
Updated 898d ago
0.0(0)
note
Public Key / Llave Pública
Updated 1241d ago
0.0(0)
note
Eukaryotic Cells (Animal & Plant)
Updated 1194d ago
0.0(0)
note
Chapter 3: Proteins
Updated 991d ago
0.0(0)
note
Verbs and Verb Tenses
Updated 1160d ago
0.0(0)
note
3.1 Intro to Culture
Updated 122d ago
0.0(0)
note
AP Statistics Unit 3 Notes
Updated 330d ago
0.0(0)
note
Plant Kingdom
Updated 898d ago
0.0(0)
note
Public Key / Llave Pública
Updated 1241d ago
0.0(0)
note
Eukaryotic Cells (Animal & Plant)
Updated 1194d ago
0.0(0)
note
Chapter 3: Proteins
Updated 991d ago
0.0(0)

Explore top flashcards

flashcards
ĐỀ 7
20
Updated 74d ago
0.0(0)
flashcards
Intro to Healthcare quiz 1
22
Updated 945d ago
0.0(0)
flashcards
The New Government Begins
55
Updated 317d ago
0.0(0)
flashcards
GLW #2
20
Updated 188d ago
0.0(0)
flashcards
APUSH Unit 8 Test
46
Updated 1093d ago
0.0(0)
flashcards
ĐỀ 7
20
Updated 74d ago
0.0(0)
flashcards
Intro to Healthcare quiz 1
22
Updated 945d ago
0.0(0)
flashcards
The New Government Begins
55
Updated 317d ago
0.0(0)
flashcards
GLW #2
20
Updated 188d ago
0.0(0)
flashcards
APUSH Unit 8 Test
46
Updated 1093d ago
0.0(0)