On 2024-03-06, Roel Schroeven via Python-list <python-list@python.org> wrote:
> Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list:
>> >>> from scoping2 import *
>
> [...]
>
> I would advice not to use 'import *', if at all possible, for multiple 
> reasons, one of which is to prevent problems like this.

Unfortunately, many (most?) tutorials for particular modules (and even
example code in the Python documentation itself) are all written
assuming that you do "from <module> import *".  It saves the tutorial
write a few keystrokes, but causes untold trouble for people who learn
incorrectly that "from <module> import *" is the proper way to do
things.

> I would also advice not to use global variables from other modules
> directly, and in fact would advice to minimize the use of globals in
> general as much as possible. If you need to keep state between
> methods, it might be better to use a class.


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to