Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1022 Bytes

feedback.md

File metadata and controls

52 lines (34 loc) · 1022 Bytes

Feedback

F-strings

Don't build strings like

def greet(name):
    return "Hello " + name

Use f-strings:

def greet(name):
    return f"Hello {name}"

They are both more readable and more efficient.

ToString methods

Drop all the to-string-like methods. They are very uninteresting and unrealistic: there's no way an object would take care of its actual representation. For example, what about localization?

OO

Drop multiple inheritance

MI is too advanced a concept.

Missing Topics

  • Access control: how to make members private/protected in python
  • Properties (getters, setters)
  • Static methods
  • Abstract methods using abc module

Validation

Never use assert to validate input.

Do not check parameter types. Python encourages duck typing, not nominal typing.

Types of Exercises

  • Have them write their own tests
  • Have them find bugs in given code
  • Have them refactor a complex function (rename variables, divide into functions)
  • Improve efficiency