[Edu-sig] What is a Python module?

Vernon Cole vernondcole at gmail.com
Tue May 3 19:14:05 CEST 2011


On Tue, May 3, 2011 at 4:00 AM, <edu-sig-request at python.org> wrote:

> [Edu-sig] What is a Python module?

I posed this question before.  The usual answer is:  a file containing
> Python source code.
>

Kirby:
  The "usual" answer is almost the correct answer.
I quote from http://docs.python.org/py3k/tutorial/modules.html which was
written by GvR himself.  A higher authority than BDFL cannot exist.
"A module is a file containing Python definitions and statements. "
I note that GvR does not mention that it must be in source form, only that
it contain definitions and statements.  The tutorial continues to give much
more information about what modules are and how they work.

 In fact, one could argue a Python module is precisely *not* the
> readable source code .py file, as that *must* be compiled to byte
> codes first, and saved in the .pyc.


One could make such an argument, but one would be incorrect.  IronPython,
for example,  _never_ compiles to .pyc byte code, but the modules I write
using it are still Python modules, and still do what modules are supposed to
do.
--
Vernon Cole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20110503/bc02a283/attachment.html>


More information about the Edu-sig mailing list