In this chapter, you learned about the Singleton design pattern and the context in which it's used. We understood that Singletons are used when there is a need to have only one object for a class.
We also looked at various ways in which Singletons can be implemented in Python. The classical implementation allowed multiple instantiation attempts but returned the same object.
We also discussed the Borg or Monostate pattern, which is a variation of the Singleton pattern. Borg allows the creation of multiple objects that share the same state unlike the single pattern described by GoF.
We went on to explore the webapp application where Singleton can be applied for consistent database operations across multiple services.
Finally, we also looked at situations where Singletons can go wrong and what situations developers need to avoid.
At the end of this chapter, we're now comfortable enough to take the next step and study other creational patterns and benefit from them.
In the next chapter, we...