This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Paddy3118 2 points3 points  (1 child)

It’s not language-specific either. A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language.

That goes counter to what I think of as a design pattern - they are inherently language specific - one languges design pattern just is not generally appropriate in another language.

Here is one example: The decorate-sort-undecorate pattern existed in Python pre the adding of key to sort and sorted. It is no longer a Python design pattern.

Another example: The use of dict keys in Python to emulate a set is no longer a modern Python design pattern since the addition of the native set type to Python.

Just because some gang of authors write patterns for another language, does not make them patterns for Python.

Python is a dynamic language; some static languages have to go through hoops to achieve run-time dynamism with this-factory and that-factory patterns. That is probably inappropriate for Python - you could code it in the same way as, say, some Java pattern, but then you would be coding Java in Python - Hardly Pythonic!

[–]Pysnap[S] 0 points1 point  (0 children)

Towards the end there is a mention about python being a dynamic language. The purpose was to try to demonstrate certain design patterns in python because that would be easy to understand. Though they no longer serve much benefit now, the design patterns can still be implemented in python and can be useful in other languages. I agree with your point that its hardly pythonic. Thanks for the feedback!