[issue21720] "TypeError: Item in ``from list'' not a string" message

Serhiy Storchaka report at bugs.python.org
Wed Oct 25 05:34:07 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

The from import already is much slower than simple import:

$ ./python -m timeit 'from encodings import aliases'
500000 loops, best of 5: 475 nsec per loop
$ ./python -m timeit 'import encodings.aliases as aliases'
1000000 loops, best of 5: 289 nsec per loop

The latter executes only C code if the module already is imported, but the former executes Python code. It may be worth to add the C acceleration for this case too.

PR 4113 makes it yet slower:
 
$ ./python -m timeit 'from encodings import aliases'
500000 loops, best of 5: 793 nsec per loop

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21720>
_______________________________________


More information about the Python-bugs-list mailing list