use import *
Ganesh Pal
ganesh1pal at gmail.com
Mon Aug 1 11:31:47 EDT 2016
Hi Team ,
I am a Linux user on python 2,6 . I have a very simple question
I was going the zen of python by Tim peters and found an example that
demonstrates Explicit is better than implicit
"""Load the cat, dog, and mouse models so we can edit instances of them."""
def load():
from menagerie.cat.models import *
from menagerie.dog.models import *
from menagerie.mouse.models import *
#-----------------------------------------------------------------------
def load():
from menagerie.models import cat as cat_models
from menagerie.models import dog as dog_models
from menagerie.models import mouse as mouse_models
#-----------------------------------------------------------------------
print 'Explicit is better than implicit.'
I had a question on the above example
1. I haven't used " from menagerie.cat.models import * is it a good
programming practice to use import * ? if answer is "NO " then are
there situation where you are forced to use import *
Regards,
Ganesh
More information about the Python-list
mailing list