Patterns for dynamic languages
Python is a dynamic language like Lisp. The dynamic nature of Python can be represented as follows:
- Types or classes are objects at runtime.
- Variables can have type as a value and can be modified at runtime. For example,
a = 5
anda = "John"
, thea
variable is assigned at runtime and type also gets changed. - Dynamic languages have more flexibility in terms of class restrictions.
- For example, in Python, polymorphism is built into the language, there are no keywords such as
private
andprotected
and everything is public by default. - Represents a case where design patterns can be easily implemented in dynamic languages.
Get Learning Python Design Patterns - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.