A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-June/144871.html below:

[Python-Dev] PEP: Ordered Class Definition Namespace

[Python-Dev] PEP: Ordered Class Definition NamespaceÉmanuel Barry vgr255 at live.ca
Tue Jun 7 14:57:16 EDT 2016
> From: Eric Snow
> Sent: Tuesday, June 07, 2016 2:52 PM
> To: Émanuel Barry
> Cc: Python-Dev
> Subject: Re: [Python-Dev] PEP: Ordered Class Definition Namespace
> 
> "dunder" names (not just methods) will not be present in
> __definition_order__.  I'll add an explanation to the PEP.  The gist
> of it is that they are reserved for use by the interpreter and will
> always clutter up __definition_order__.  Since needing dunder names
> included in __definition_order__ would be rather exceptional, and
> there are other options available, leaving them out by default is a
> matter of practicality.

Good point. I'll assume that if we need that we'll do something in the metaclass.

> What is the value of type.definition_order()?  If you need a mutable
> copy then pass __definition_order__ to list().

I think I explained it backwards. I meant to have a method on ``type`` (which metaclasses can override at will) which will set what is passed to the resulting __definition_order__ attribute. But it might not be needed, as we can probably sneak that inside the namespace in the metaclass' __new__.

> > Additionally
> > I'm not sure if setting the attribute to None is a good idea; I'd have it as
> > an empty tuple. Then again I tend to overthink a lot.
> 
> None indicates that there is no order.  An empty tuple indicates that
> there were no attributes.

Fair enough.

> 
> -eric

-Emanuel
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4