Prototype API Documentation
Prototype Pattern Implementation in Python.
This module provides an implementation of the Prototype Pattern, enabling object creation by cloning existing instances instead of instantiating new ones.
- class Prototype[source]
Bases:
ABCAbstract base class for prototypes.
Defines the interface for cloning and displaying objects.
- class ConcretePrototype1(attribute)[source]
Bases:
PrototypeA concrete implementation of the Prototype interface with a string attribute.
- Parameters:
attribute (str)
- __init__(attribute)[source]
Initialize the prototype with a string attribute.
- Parameters:
attribute (
str) – A string representing the object’s attribute.
- class ConcretePrototype2(attribute)[source]
Bases:
PrototypeA concrete implementation of the Prototype interface with an integer attribute.
- Parameters:
attribute (int)
- __init__(attribute)[source]
Initialize the prototype with an integer attribute.
- Parameters:
attribute (
int) – An integer representing the object’s attribute.