Kamaropoulos / COVID19Py

A tiny Python package for easy access to up-to-date Coronavirus (COVID-19, SARS-CoV-2) cases data.
https://pypi.org/project/COVID19Py/
GNU General Public License v3.0
84 stars 57 forks source link

Singleton Pattern for Creational Design Pattern #123

Closed Colin-J-School closed 2 years ago

Colin-J-School commented 3 years ago

In this commit, I implement a Creational Design Pattern, the Singleton Pattern. The Singleton Pattern needs to meet three requirements: The constructor is already private so the first requirement is met A private instance is created and stored Def implemented to allow access to the current instance Also checks upon initialization in the constructor if an instance is already present to ensure it follows the Singleton Pattern