On 13 September 2016 at 17:29, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Sep 14, 2016 at 2:16 AM, Pim Schellart > <p.schell...@princeton.edu> wrote: >> Semantics >> ========= >> >> The following two snippets are semantically identical:: >> >> continue class A: >> x = 5 >> def foo(self): >> pass >> def bar(self): >> pass >> >> def foo(self): >> pass >> def bar(self): >> pass >> A.x = 5 >> A.foo = foo >> A.bar = bar >> del foo >> del bar > > Did you know that you can actually abuse decorators to do this with > existing syntax? Check out this collection of evil uses of decorators: > > https://github.com/Rosuav/Decorators/blob/master/evil.py > > I call them "evil" because they're potentially VERY confusing, but > they're not necessarily bad.
Also, it's worth noting that while Ruby has a tradition of "open" classes (as in, the ability to add methods to class definitions after those classes have been created) Python traditionally does not encourage such use. You claim in your proposal """ This pattern frequently occurs when extending classes from extension modules written in other languages, but is also not uncommon in pure Python code. """ but to be honest I don't recall seeing this pattern commonly used. That's not to say that the feature might not be useful, but I think you'll need a bit more justification, and examples of code that would be improved by this proposal, if you want to get it accepted. 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/