Tkinter documentation contradicts PEP8

PEP 8 Status

Importing wildcards (from import *) should be avoided since they do not make it possible to understand which names are present in the namespace, confusing readers as well as many automated tools.

However, the official documentation contradicts:

to use Tkinter all you need is a simple import statement:

import tkinter 

Or more often:

  from tkinter import * 

Is this a "documentation error"?

+4
source share
1 answer

I raised the error question 32830 on this issue, and the consensus (reached by the developers of the Python kernel) is that although from tkinter import * violates PEP 8, this is a reasonable exception because tkinter "provides a huge number of names (mostly constants like RIGHT or VERTICAL), which is convenient to use without a prefix. " In addition, PEP 8 states: “Do not break backward compatibility to match this PEP!” and since tkinter is often imported this way at present, this feeling applies here.

+1
source

Source: https://habr.com/ru/post/1498018/


All Articles