Objective
|
Page Index
Lesson
As powerful as Python is, it would be almost impossible to write meaningful code without importing certain modules. Yes, handwritten code can sometimes replace information available in a module. For example, your code might contain the statement: lower = 'abcdefghijklmnopqrstuvwxyz'
and your hand-written code is as good as: lower = string.ascii_lowercase
In this situation you might decide that it's not necessary to But, what about a statement like: error = sys.exc_info()
This statement provides essential information about the most recent error which execution of your code has caused. Only an expert could create hand-written code to replace this statement and an expert would not want to do so. When so many powerful features are available in python's modules, it makes good sense to use them. With appropriate modules imported, your code reflects your good knowledge of python and your willingness to reap the benefits of the labor of others whose contribution to python makes our professional lives easier. You're already familiar with some of python's modules: In this lesson we'll look first at module Module string
Creating your own module
globals() unique to each module
|
Assignments
In the output of
|
Further Reading or Review
|
References
1. Python's documentation: "6. Modules", "string — Common string operations", "decimal — Decimal fixed point and floating point arithmetic", "7.11. The import statement"
"globals()", "dir( [object] )", "eval(expression[, globals[, locals]])" |