From 151d1c5a0cd9966045fa45aa9ada80372007f645 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 20 Dec 2016 18:30:42 +0100 Subject: [PATCH] Suggest starting multi-line imports on the next line to pass flake8 (#923) --- PYTHON_STYLE_GUIDE.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PYTHON_STYLE_GUIDE.md b/PYTHON_STYLE_GUIDE.md index 1c29117e..befe4eeb 100644 --- a/PYTHON_STYLE_GUIDE.md +++ b/PYTHON_STYLE_GUIDE.md @@ -47,8 +47,15 @@ It seems the preference is for slashes, but using parentheses is okay too. (Ther If you need to `import` lots of names from a module or package, and they won't all fit in one line (without making the line too long), then use parentheses to spread the names across multiple lines, like so: ```python +from Tkinter import ( + Tk, Frame, Button, Entry, Canvas, Text, + LEFT, DISABLED, NORMAL, RIDGE, END, +) + +# Or + from Tkinter import (Tk, Frame, Button, Entry, Canvas, Text, - LEFT, DISABLED, NORMAL, RIDGE, END) + LEFT, DISABLED, NORMAL, RIDGE, END) ``` For the rationale, see [PEP 328](https://www.python.org/dev/peps/pep-0328/#rationale-for-parentheses).