[Edu-sig] What is a Python module?
kurner at oreillyschool.com
Tue May 3 19:53:01 CEST 2011
I appreciate your quoting GvR and continue to note that the source might
already be yummy byte code in whatever target VM language, be that Java's or
Mono's or some VM not yet written.
"Source code is one step away from runtime digestible, in still needing to
be parsed, and as such need not be distributed with compiled Python modules"
would seem to be a true statement.
One might imagine a "Python chat window" showing up as a chat service
(shell) and behaving much as an ordinary Python interpreter in REPL mode
(great for learning, we all agree).
But behind the scenes, there's a lot of cloudy stuff, with some algorithms
implemented in what looks to be LISP or Scheme. Obviously the CLR byte
codes are runnable, but the source is mostly not even Python.
So you go
>>> import math
but behind the scenes it's like J or something, with some bytecodes to a
local engine via JSON perhaps, for AJAXy fun.
On Tue, May 3, 2011 at 10:14 AM, Vernon Cole <vernondcole at gmail.com> wrote:
> 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.
> 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
> Vernon Cole
> Edu-sig mailing list
> Edu-sig at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Edu-sig