On 7 June 2016 at 14:20, Eric Snow <ericsnowcurrently@gmail.com> wrote:
On Tue, Jun 7, 2016 at 12:30 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
The main alternative would be to make __definition_order__ writable, so the default behaviour would be for it to reflect the original class body, but decorators would be free to update it to reflect their changes, as well as to make other modifications (e.g. stripping out all callables from the list).
I think both of those make __definition_order__ more complicated and less useful. As the PEP stands, folks can be confident in what __definition_order__ represents. What would you consider to be the benefit of a mutable (or replaceable) __definition_order__ that outweighs the benefit of a simpler definition of what's in it.
Mainly the fact that class decorators and metaclasses can't hide the difference between "attributes defined in the class body" and "attributes injected by a decorator or metaclass". I don't have a concrete use case for that, it just bothers me on general principles when we have things the interpreter can do that can't readily be emulated in Python code. However, if it proves to be a hassle in practice, making it writable can be done later based on specific use cases, so I don't mind if the PEP stays as it is on that front. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia