faif / python-patterns

A collection of design patterns/idioms in Python
40.46k stars 6.94k forks source link

Gradually add type hints to the examples #325

Closed rednafi closed 4 years ago

rednafi commented 4 years ago

A few examples (like the delegation pattern) can be difficult to understand without type hints. Unless you want to keep backward compatibility with older Python versions, adding type hints can make the intents of the code snippets clearer.

faif commented 4 years ago

That is a good suggestion. Backward compatibility is not extremely useful, since Python 2.x has reached EOL

rednafi commented 4 years ago

Yeah, since you can add the type hints gradually, it shouldn't be problem to convert. I've already added type checking to the delegation pattern and sent a PR.

fkromer commented 4 years ago

That is a good suggestion. Backward compatibility is not extremely useful, since Python 2.x has reached EOL

"Le roi est mort, vive le roi" :wink:

faif commented 4 years ago

Closing it since the effort has already started. Thanks @rednafi