Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

Package Exercises

  1. Create a Package. In the previous chapter's exercises (see the section called “Refactor a Script”) are some suggestions for creating a simple module. The modules decribed in that exercise are so small that adding modules does not seem necessary. However, it's the best example of how packages arise when solving practical problems.

    Pick a module that you've already created. Add a second file with a few simple classes that do little real work. These are best described as "Hello World" classes, since they don't do anything more useful than provide a simple response to indicate that the module was imported correctly.

    Create a packge directory with the necessary __init__.py file.

    Create a demonstration script which imports and exercises both modules from this package.


 
 
  Published under the terms of the Open Publication License Design by Interspire