On 12 February 2017 at 04:37, Steven D'Aprano <st...@pearwood.info> wrote: >> Making a dedicated syntax or decorator for patching is saying that we >> (the language) think you should do it. > > We already have that syntax: > > anything.name = thing
And the point here is that we don't need to extend def, because we already have that syntax. Adding new syntax for something that we can already do is generally accepted when the "thing we can already do" is deemed sufficiently important that it's worth making it a language feature in its own right. Decorators are a prime example of this - before the decorator syntax was added, decorating functions was just something that people occasionally did, but it wasn't a specific "concept". I'd argue that method injection (to use your phrase) isn't sufficiently important to warrant promotion to language syntax. I will say, though, that you're right that we've over-reacted a bit to the monkeypatching use case. Although maybe that's because no-one can think of many *other* use cases that they'd need the new syntax for :-) Paul _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/