[issue31581] Reduce the number of imports for functools

2017-09-30 Thread INADA Naoki

Change by INADA Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-30 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 9811e80fd0ed9d74c76a66f1dd4e4b8afa9e8f53 by INADA Naoki in branch 
'master':
bpo-31581: Reduce the number of imports for functools (GH-3757)
https://github.com/python/cpython/commit/9811e80fd0ed9d74c76a66f1dd4e4b8afa9e8f53


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

An option for deferred imports would be to leave a comment at the top where the 
import would otherwise be.  Example:

# import types, weakref  # Deferred to single_dispatch()

This accomplishes the PEP8 purpose of making all dependencies of the module 
visible at the top.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Go ahead.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Initially my patch for issue30152 included the change in collections. But it 
was removed on Raymond's request.

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-25 Thread INADA Naoki

Changes by INADA Naoki :


--
keywords: +patch
pull_requests: +3743
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31581] Reduce the number of imports for functools

2017-09-25 Thread INADA Naoki

New submission from INADA Naoki:

Makes `import functools` about 1.5 ms faster.

* heapq is used only when Counter.most_common(n).
* types and waakref is used only for singledispatch.

master:

import time:   - _functools 76 us (self 76 us)
import time:   - _operator 110 us (self 110 us)
import time: - operator 469 us (self 359 us)
import time: - keyword 174 us (self 174 us)
import time:   - _heapq 189 us (self 189 us)
import time: - heapq 400 us (self 211 us)
import time: - itertools 137 us (self 137 us)
import time: - reprlib 231 us (self 231 us)
import time: - _collections 142 us (self 142 us)
import time:   - collections 3006 us (self 1456 us)
import time: - collections.abc 191 us (self 191 us)
import time:   - types 518 us (self 327 us)
import time:   - weakref 577 us (self 577 us)
import time: - functools 4903 us (self 729 us)

patched:

import time:   - _functools 74 us (self 74 us)
import time:   - _operator 100 us (self 100 us)
import time: - operator 460 us (self 361 us)
import time: - keyword 174 us (self 174 us)
import time: - itertools 139 us (self 139 us)
import time: - reprlib 226 us (self 226 us)
import time: - _collections 85 us (self 85 us)
import time:   - collections 2593 us (self 1512 us)
import time: - functools 3369 us (self 703 us)

--
components: Library (Lib)
messages: 302998
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Reduce the number of imports for functools
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com