[Tutor] Understanding (Complex) Modules

David Hutto dwightdhutto at yahoo.com
Thu Mar 4 03:03:09 CET 2010



--- On Wed, 3/3/10, Wayne Watson <sierra_mtnview at sbcglobal.net> wrote:

From: Wayne Watson <sierra_mtnview at sbcglobal.net>
Subject: [Tutor] Understanding (Complex) Modules
To: tutor at python.org
Date: Wednesday, March 3, 2010, 8:24 PM

First a little preamble before my questions.

Most of my work in Python has required modifying a program that uses modules that were imported by the original program. I've made some use of modules on a command line like math, and have used the idea of a qualifier.  On occasion, I've used examples from matplotlib that required from matplotlib.image import AxesImage. Further, I've created some simple classes, and produced  objects with them. No use of inheritance though.  So far so good.  In a few places, it is said modules are objects. I'm slightly puzzled by that, but in some way it seems reasonable from the standpoint of period notation. So far I have not created a module.

In Lutz's and Ascher's Learning Python, ed. 2, chap. 16, they describe the following example, among others:

module2.py as

print "starting to load ..."
import sys
def func(): pass
class klass: pass
print "done loading."

Their description of its use is quite readable.  It shows that there is some more to a module than a list of defs, for example.

Here comes the questions. Recently I began to use matplotlib, scipy, and pylab, mostly matplotlib. I've ground out a few useful pieces of code, but I'm fairly baffled by the imports required to get at various elements, of say, matplotlib (MPL).  Some of the MPL examples use of imports make sense, but how the writer pulled in the necessary elements is not.  How does one go about understanding the capabilities of such modules? MPL seems to have a lot of lower level components. Some of them are laid out over numerous pages as in the form of a, say, English language, description. How does one decipher this stuff.  For example, open the module in an editor and start looking at the organization? I thinkthe so called MPL guide ins 900 pages long. Even the numpy guide (reference?), I believe borders on 1000 pages. There must be some way to untangle these complex modules, I would think. Some of the tutorials seem nothing more than a template to follow for a
 particular problem.  So far, looking at the plentiful number of examples of MPL, and probably some of the other modules mentioned above have not provided a lot of insight.

 Is there some relationship between modules and objects that I'm not seeing that could be of value?




--            Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

               Stop the illegal killing of dolphins and porpoises.
                     <http://www.takepart.com/thecove>
              Wrest the control of the world's fisheries from Japan.

                    Web Page:<www.speckledwithstars.net/>

_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

How about importing your foot into your ass, for trying to ask an educated question and answering it through a false addresss by yourself.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100303/60230de0/attachment-0001.html>


More information about the Tutor mailing list