[Tutor] Tutor Digest, Vol 61, Issue 3

Eric Dorsey dorseye at gmail.com
Sun Mar 1 23:27:48 CET 2009

Not sure if this is what you mean, but:
Say you have the files efunc.py and trytry.py in the same folder.

*The content of efunc.py is:*
def funky():
    print 'funkytown'

*The content of trytry.py is:*
import efunc


*Output would be:*
name at ububox:~$ python trytry.py
name at ububox:~$

trtry.py "easily and automatically" uses the code from efunc.py It calls the
function funky(). Granted this is a prety silly example, but is that what
you mean by using code written by someone else? You do this with modules all
the time, like import os, import glob, etc. Any .py file imported into
another .py file is a module, granted most of them are a bit more useful
than efunc.py

> I'm sorry, I've realized I didn't explain my needs at all.
> I was a little influenced by drupal's definition of modules, which is
> completely different from python's.
> With module here I meant plug-in or extension: a piece of code written
> by someone else that can be easily (and automaticallly) integrated
> into my program.
> My program must provide the posibility to be extended without editing
> its code, just like mozilla's add-ons.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090301/9d3f2574/attachment.htm>

More information about the Tutor mailing list