korrents

korrents · piece

Subclassing in Python Redux

Hynek Schlawack · 22 Jun 2021

Read the piece on hynek.me ↗

2 korrents from this piece ↓

Hynek Schlawack did not write this page.

Every claim below was made in this piece, quoted word for word and numbered in the order the piece makes them, so you can read it there rather than take our word for it. The sentence above each quote is our reading of the claim, not their wording. Each quote was checked against a stored copy of the page at build time; where the two differ, the quote is the fact.

  1. If you want to customize more than one behavioral aspect of a class, code sharing via subclassing won't work. It leads to subclass explosion.
  2. When it comes to reading clarity, properly-done composition is superior to inheritance.

Keep reading