[Python-Dev] PEP 560 (original) (raw)

Terry Reedy tjreedy at udel.edu
Wed Nov 15 17:36:41 EST 2017


On 11/14/2017 3:26 PM, Ivan Levkivskyi wrote:

After some discussion on python-ideas, see https://mail.python.org/pipermail/python-ideas/2017-September/047220.html, this PEP received positive comments. The updated version that takes into account the comments that appeared in the discussion so far is available at https://www.python.org/dev/peps/pep-0560/

Here I post the full text for convenience: ++++++++++++++++++++++++++ PEP: 560 Title: Core support for typing module and generic types Author: Ivan Levkivskyi <levkivskyi at gmail.com <mailto:levkivskyi at gmail.com>> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 03-Sep-2017 Python-Version: 3.7 Post-History: 09-Sep-2017 ...

Suggested wording improvements:

Performance -----------

The typing module is one of the heaviest and slowest modules in the standard library even with all the optimizations made.

Mainly this is because of subscripted generic types (see PEP 484 for definition of terms used in this PEP) are class objects (see also [1]).

Delete 'of' after 'because' to make this a proper sentence.

The three main ways how

"There are three ..." reads better to me.

the performance can be improved with the help of the proposed special methods:

- Creation of generic classes is slow since the GenericMeta._new_ is very slow; we will not need it anymore. - Very long MROs for generic classes will be twice shorter;

I believe by 'twice shorter', which is meaningless by itself, you mean 'half as long'. If so, please say the latter.

they are present because we duplicate the collections.abc inheritance chain in typing.

- Time of instantiation of generic classes will be improved

Instantiation of generic classes will be faster.

(this is minor however).

-- Terry Jan Reedy



More information about the Python-Dev mailing list