O'Reilly logo

Software Architecture with Python by Anand Balachandran Pillai

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Patterns in Python – structural

Structural patterns concern themselves with the intricacies of combining classes or objects to form larger structures that are more than the sum of their parts.

Structural patterns implement this in these two distinct ways:

  • By using class Inheritance to compose classes into one. This is the static approach.
  • By using object composition at runtime to achieve combined functionality. This approach is more dynamic and flexible.

Python, by virtue of supporting multiple inheritance, can implement both of these very well. Being a language with dynamic attributes and using the power of magic methods, Python can also do object composition and the resultant method wrapping pretty well also. So, with Python, a programmer is indeed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required