[Python-Dev] Imports with underscores

Terry Reedy tjreedy at udel.edu
Mon Jan 9 15:29:38 EST 2017


On 1/9/2017 11:48 AM, Guido van Rossum wrote:
> I would focus on changing habits to discourage "import *" rather than

The tkinter doc still has

...to use Tkinter all you need is a simple import statement:
   import tkinter
Or, more often:
   from tkinter import *

Should this be changed?

> uglifying all new code with this "os as _os" pattern. Very occasionally
> one designs a module to explicitly support "import *", and that usually
> entails using __all__ (like it or not), making the problem go away
> without uglifying the code.

tkinter does not have have __all__.  It would have 160 (in 3.6) minus at 
least 3 (for enum, re, and sys) entries.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list