On 2021-06-20 at 12:18:24 -0000, Johan Vergeer <johanverg...@gmail.com> wrote:
> After working with Kotlin for a while I really started to like the > idea of extension methods. I delivers a great way to extend the > language without having to add features to the language itself. I disagree with the premise that such a thing is great, although it does have limited use cases (mostly revolving around bugs, whether you know about the bug or are tracking it down). That said, Python already allows it: >>> class C: pass >>> c = C() >>> C.f = lambda self, *a: a # add method f to class C >>> c.f(5, 6) (5, 6) See also <https://en.wikipedia.org/wiki/Monkey_patch>. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/AFPRRXLWK2ZHXVUTRRJ57KI6HF6LWZH6/ Code of Conduct: http://python.org/psf/codeofconduct/