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/144934.html below:

[Python-Dev] PEP 520: Ordered Class Definition Namespace

[Python-Dev] PEP 520: Ordered Class Definition Namespace [Python-Dev] PEP 520: Ordered Class Definition NamespaceTerry Reedy tjreedy at udel.edu
Wed Jun 8 18:22:22 EDT 2016
On 6/8/2016 4:07 AM, Victor Stinner wrote:
>> Abstract
>> ========
>>
>> This PEP changes the default class definition namespace to ``OrderedDict``.
>> Furthermore, the order in which the attributes are defined in each class
>> body will now be preserved in ``type.__definition_order__``.  This allows
>> introspection of the original definition order, e.g. by class decorators.
>>
>> Note: just to be clear, this PEP is *not* about changing ``__dict__`` for
>> classes to ``OrderedDict``.
>
> What is the cost in term of performance?
>
> What can be slower: define a new class and/or instanciate a class?

A class is defined once, used many times to instantiate instances.  Each 
instance is typically used many times, with many lookups.  So it is 
self.class_attribute lookups, like method lookups, that likely matter 
the most, and which are not changed by the PEP.

-- 
Terry Jan Reedy

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