Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python Design Patterns

You're reading from   Mastering Python Design Patterns A guide to creating smart, efficient, and reusable software

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781788837484
Length 248 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Sakis Kasampalis Sakis Kasampalis
Author Profile Icon Sakis Kasampalis
Sakis Kasampalis
Kamon Ayeva Kamon Ayeva
Author Profile Icon Kamon Ayeva
Kamon Ayeva
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. The Factory Pattern FREE CHAPTER 2. The Builder Pattern 3. Other Creational Patterns 4. The Adapter Pattern 5. The Decorator Pattern 6. The Bridge Pattern 7. The Facade Pattern 8. Other Structural Patterns 9. The Chain of Responsibility Pattern 10. The Command Pattern 11. The Observer Pattern 12. The State Pattern 13. Other Behavioral Patterns 14. The Observer Pattern in Reactive Programming 15. Microservices and Patterns for the Cloud 16. Other Books You May Enjoy

Other Creational Patterns

In the previous chapter, we covered a third creational pattern, that is, builder, which offers a nice way of creating the various parts of a complex object. Besides the factory method, the abstract factory, and the builder patterns covered so far, there are other creational patterns that are interesting to discuss, such as the prototype pattern and the singleton pattern.

What is the prototype pattern? The prototype pattern is useful when one needs to create objects based on an existing object by using a cloning technique.

As you may have guessed, the idea is to use a copy of that object's complete structure to produce the new object. We will see that this is almost natural in Python because we have a copy feature that helps greatly in using this technique.

What is the singleton pattern? The singleton pattern offers a way to implement a class from...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image