faif / python-patterns

A collection of design patterns/idioms in Python
40.2k stars 6.93k forks source link

Closes #377: No return value expeced :bug: #378

Closed g-paras closed 3 years ago

g-paras commented 3 years ago

I have used class name with quotes as return type because we can not use class name before its definition.

1 file changed .\patterns\creational\prototype.py

@@ -29,7 +29,7 @@ def __init__(self, value: str = "default", **attrs: Any) -> None:
        self.value = value
        self.__dict__.update(attrs)

-   def clone(self, **attrs: Any) -> None:
+   def clone(self, **attrs: Any) -> "Prototype":
        """Clone a prototype and update inner attributes dictionary"""
        # Python in Practice, Mark Summerfield
        # copy.deepcopy can be used instead of next line.