OOP Flashcards

1
Q

Initializer

A

__init__

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

__init__

A

instance method that initializes a newly created object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

__dict__

A

dictionary or other mapping object used to store object’s attributes
MyClass.__dict__ for class attributes
obj.__dict__ for instance attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Attribute Access Flow

A
  1. instance attributes
  2. class attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Method Object

A
class MyClass:
    def func(self):
        ...

obj = MyClass()
obj.func - method object
MyClass.func - function object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Class Method

A
@classmethod
def method(cls):
    ... 

can be called from an instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Static Method

A
@staticmethod
def method():
    ... 

can be called from an instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

__class__

A

reference to the class of an object
self.__class__
obj.__class__

How well did you know this?
1
Not at all
2
3
4
5
Perfectly