Is there a "wrong" way to use the import function?

A forum for general discussion of the Python programming language.

Is there a "wrong" way to use the import function?

Postby Stosswalkinator » Wed Jul 24, 2013 3:33 am

I was on /r/learnpython the other day and I saw someone comment that you should never use:
Code: Select all
from ____ import *

It kind of confused me because I'm new(ish) to Python and that's how I learned to import when I didn't just import something specific. Doesn't it just import the whole module? Is there a right or wrong way to import (unless, of course, it doesn't work)?
Stosswalkinator
 
Posts: 1
Joined: Tue Jul 23, 2013 9:43 pm

Re: Is there a "wrong" way to use the import function?

Postby micseydel » Wed Jul 24, 2013 4:20 am

(1) import is a statement, not a function. If this doesn't make sense yet, don't worry, it's not super important but you'll learn it eventually.
(2) http://www.python-forum.org/viewtopic.php?f=25&t=4822
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 923
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest