[Python-Dev] PEP 520: Ordered Class Definition Namespace (original) (raw)
Eric Snow ericsnowcurrently at gmail.com
Fri Jun 10 12:42:32 EDT 2016
- Previous message (by thread): [Python-Dev] PEP 520: Ordered Class Definition Namespace
- Next message (by thread): [Python-Dev] PEP 520: Ordered Class Definition Namespace
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jun 9, 2016 at 2:39 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
I'm guessing Ethan is suggesting defining it as:
definitionorder = tuple(ns["definitionorder"]) When the attribute is present in the method body.
Ah. I'd rather stick to "consenting adults" in the case that definition_order is explicitly set. We'll strongly recommend setting it to None or a tuple of identifier strings.
That restriction would be comparable to what we do with slots today: >>> class C: ... slots = 1 ... Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not iterable
Are you suggesting that we require it be a tuple of identifiers (or None) and raise TypeError otherwise, similar to slots? The difference is that slots has specific type requirements that do not apply to definition_order, as well as a different purpose. definition_order is about preserving definition-type info that we are currently throwing away.
-eric
- Previous message (by thread): [Python-Dev] PEP 520: Ordered Class Definition Namespace
- Next message (by thread): [Python-Dev] PEP 520: Ordered Class Definition Namespace
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]