summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/README.txt
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2016-08-31 04:50:55 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2016-08-31 04:50:55 (GMT)
commitbfbaa6b206abdb8b1c3861926f4334b879ec91cc (patch)
treea06ead659eacb714127ad34289a543942d14e4e6 /Lib/idlelib/README.txt
parent89b1162511dd62e285c1911013f07b45af07f70a (diff)
downloadcpython-bfbaa6b206abdb8b1c3861926f4334b879ec91cc.zip
cpython-bfbaa6b206abdb8b1c3861926f4334b879ec91cc.tar.gz
cpython-bfbaa6b206abdb8b1c3861926f4334b879ec91cc.tar.bz2
Issue #27891: Consistently group and sort imports within idlelib modules.
Diffstat (limited to 'Lib/idlelib/README.txt')
-rw-r--r--Lib/idlelib/README.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt
index f7aad68..e52b5cd 100644
--- a/Lib/idlelib/README.txt
+++ b/Lib/idlelib/README.txt
@@ -228,4 +228,23 @@ Help
<No menu>
Center Insert # eEW.center_insert_event
-
+
+
+CODE STYLE -- Generally PEP 8.
+
+import
+------
+Put import at the top, unless there is a good reason otherwise.
+PEP 8 says to group stdlib, 3rd-party dependencies, and package imports.
+For idlelib, the groups are general stdlib, tkinter, and idlelib.
+Sort modules within each group, except that tkinter.ttk follows tkinter.
+Sort 'from idlelib import mod1' and 'from idlelib.mod2 import object'
+together by module, ignoring within module objects.
+Put 'import __main__' after other idlelib imports.
+
+Imports only needed for testing are not at the top but are put in the
+htest function def or the "if __name__ == '__main__'" clause.
+
+Within module imports like "from idlelib.mod import class" may cause
+circular imports to deadlock. Even without this, circular imports may
+require at least one of the imports to be delayed until a function call.