New submission from STINNER Victor:

I ran pyflakes on Python 3.5. Attached patch removes unused imports.

Sometimes, it's tricky to decide if an import is useless or if it is part of 
the API.

Strange example using import to define a method!
---
class Message:
    ...
    def get_charsets(self, failobj=None):
        ...
    # I.e. def walk(self): ...
    from email.iterators import walk
---

For the email module, I moved "from quopri import decodestring as _qdecode" 
from Lib/email/utils.py to email submodules where it used.

I made a similar change in multiprocessing for "from subprocess import 
_args_from_interpreter_flags".

Since "_qdecode" and "_args_from_interpreter_flags" are private functions, I 
don't consider that they were part of the public API.

Removing imports might reduce the Python memory footprint and speedup the 
Python startup.

----------
files: unused_imports.patch
keywords: patch
messages: 214073
nosy: barry, haypo, jnoller, r.david.murray, sbt
priority: normal
severity: normal
status: open
title: pyflakes: remove unused imports
versions: Python 3.5
Added file: http://bugs.python.org/file34511/unused_imports.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20976>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to