[Python-Dev] PEP 520: Ordered Class Definition Namespace
ethan at stoneleaf.us
Thu Jun 9 18:11:50 EDT 2016
On 06/09/2016 02:39 PM, Nick Coghlan wrote:
> On 7 June 2016 at 20:17, Eric Snow wrote:
>> On Tue, Jun 7, 2016 at 6:20 PM, Ethan Furman wrote:
>>> If __definition_order__ is supposed to be immutable as well as read-only
>>> then we should convert non-tuples to tuples. No point in letting that
>>> user bug slip through.
>> Do you mean if a class explicitly defines __definition_order__? If
>> so, I'm not clear on how that would work. It could be set to
>> anything, including None or a value that does not iterate into a
>> definition order. If someone explicitly set __definition_order__ then
>> I think it should be used as-is.
> I'm guessing Ethan is suggesting defining it as:
> __definition_order__ = tuple(ns["__definition_order__"])
> When the attribute is present in the method body.
Yup, that it's it exactly. Thanks, Nick!
More information about the Python-Dev