Day 2 Review Flashcards

(9 cards)

1
Q

What is a Python decorator?

A

A function that modifies other functions.

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

How can you make a class inherit from another class?

A
Import the base class in the sub-class file
Add the base class to the constructor of the sub-class
Use base class data in the subclass file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which function helps a sub class inherit the constructor of the base class?

A

super()

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

A class method takes the parameter(s):

A

(cls)

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

Doctrings and comments should be used:

A

To explain HOW and WHY the code works

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

Can you look at metadata using Python?

A

Yes! Metaprogramming!

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

Does every method in your class need to have a decorator?

A

No! Decorators are functions that modify other functions. If they don’t need to be modified, you don’t need a decorator!

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

True or False: There is no support for third party libraries in Python

A

FALSE - pypi.org!

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

Can subclasses inherit from multiple base classes in Python?

A

Yes! Multiple inheritance - method resolution order helps!

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