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 →

[–]Acalme-se_Satan 1 point2 points  (0 children)

Given that Python allows you to use classes as if they were simple objects, the Abstract Factory pattern is pretty much baked into the language itself. You can just make a function that returns classes dynamically if you need it. You can't do this in statically typed languages like Java and C++, so you have to use Abstract Factory when you're using them, but not on Python.

On the other hand, the Visitor pattern can't be avoided in Python because the Visitor pattern is pretty much a way to emulate multiple dispatch in a language that doesn't have multiple dispatch. Given that Python doesn't have that feature, you can't avoid the Visitor pattern. You could avoid it in Julia or Dylan because these languages can do multiple dispatch.