For marketers
who love technology
Home » » why "from toto Import *" is a bad idea in Python programs.

why "from toto Import *" is a bad idea in Python programs.

In this post, I will explain you why the good practice in Python programs is to carefully import only what is necessary to run your program. Let's start with an example. Sometimes, I feel lazy and use:

from toto import *

This is a bad idea, as sometimes the name of the things that you import will conflict with the name of other things in your programs. And this can be a nightmare to debug. So, try not to be lazy and rather define explicitly what you want to import with:

import toto
or
from toto import titi, tata

SHARE

About Gilles

0 comments :

Post a Comment