3 ms·
> there is nothing about Ruby that makes it more or less prone to monkey-patching than many other dynamic languages. Python disallows making changes to fundame
by pansa2 7y ago
> there is nothing about Ruby that makes it more or less prone to monkey-patching than many other dynamic languages.
Python disallows making changes to fundamental types like `int` and `list`. It’s not possible for a Python framework to support something like Rails’ `2.days.ago`.
Interestingly, I don’t think this was an explicit decision made when designing Python - it’s just a side effect of the built-in types being written in C rather than in Python itself.
- switch007 7y ago> Python disallows making changes to fundamental types like `int` and `list`. Not directly via Python but you can achieve if it you really want https://github.com/clarete/forbiddenfruit https://github.com/clarete/forbiddenfruit :D
- btilly 7y agoTrue, more things are objects in Ruby than Python. But you can still monkeypatch classes in Python.