Page 245 - Beginning Programming with Pyth - John Paul Mueller
P. 245

 FIGURE 11-3: A directory listing shows that Python imports both functions from the package.
FIGURE 11-4: The SayHello() and SayGoodbye() functions output the expected text.
Using the from...import statement
The from...import statement has the advantage of importing only the attributes you need from a package. This difference means that the package uses less memory and other system resources than using the import statement does. In addition, the from...import statement makes the package a little easier to use because some commands, such as dir(), show less information, or only the information that you actually need. The point is that you get only what you want and not anything else. The following steps demonstrate using the from...import statement.
   






























































































   243   244   245   246   247