1. Convert a pd.Series to a pd.DataFrame using .to_frame().
  2. isinstance can check for multiple classes at once
  3. The use of @property, and how a property object returns the same property object with additional settings applied onto it. This allows for its use as @property_name.setter and @property_name.deleter. Typically, the true underlying property is preceded with an underscore and is not defined in __init__. For example:
@property
def height(self):
    return self._height
  1. New modules
    • patchy to patch snippets of (other packages’) code
    • importlib.import_module to programmatically import a module
  2. **kwargs supplied the __init__ of a concrete class will include abstract class parameters in the tooltip.
  3. Similarly, only include concrete-class specific arguments in the concrete class documentation.
  4. Much like dict.get, hasattr contains a third positional argument for defaults.
  5. Feel free to have method return the instance via return self. This helps to enable method chaining.

Questions

  • Why use dict.get(key) instead of dict[key]?