Day 2 Review Flashcards
(9 cards)
What is a Python decorator?
A function that modifies other functions.
How can you make a class inherit from another class?
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
Which function helps a sub class inherit the constructor of the base class?
super()
A class method takes the parameter(s):
(cls)
Doctrings and comments should be used:
To explain HOW and WHY the code works
Can you look at metadata using Python?
Yes! Metaprogramming!
Does every method in your class need to have a decorator?
No! Decorators are functions that modify other functions. If they don’t need to be modified, you don’t need a decorator!
True or False: There is no support for third party libraries in Python
FALSE - pypi.org!
Can subclasses inherit from multiple base classes in Python?
Yes! Multiple inheritance - method resolution order helps!