Book Image

Mastering Python Design Patterns

By : Sakis Kasampalis
Book Image

Mastering Python Design Patterns

By: Sakis Kasampalis

Overview of this book

Table of Contents (23 chapters)
Mastering Python Design Patterns
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
The Factory Pattern
Index

A software example


The Exaile music player [j.mp/exaile] uses Flyweight to reuse objects (in this case, music tracks) that are identified by the same URL. There's no point in creating a new object if it has the same URL as an existing object, so the same object is reused to save resources [j.mp/exailefly].

Peppy, an XEmacs-like editor implemented in Python [j.mp/peppyp], uses the Flyweight pattern to store the state of a major mode status bar. That's because unless modified by the user, all status bars share the same properties [j.mp/peepyfly].