On Oct 29, 2007, at 7:59 PM, Ian Mallett wrote:
On 10/29/07, Greg Ewing <[EMAIL PROTECTED]> wrote:
Also -- what's with all the exclamation marks? Do you like
to write your comments comic-book style or something? :-)
I do! :-)
I've had problems with.pyc files, where I've made a nice module,
tested it, decided to move it to another folder, and found that no
matter how many times I changed it, the program still ran as
before. Apparently, Python prefers .pyc files in the current
directory to un-compiled source in another. That's caused me lots
of trouble lots of times.
Python always checks for source files first (.py), but lacking that
it will also looks for the bytecode compiled version of the module
(.pyc or .pyo), so if you remove the source file but not the .pyc the
module is still there from python's point of view.
This is so that people can distribute modules without the source code
if they choose to. Granted it is not impossible to reverse engineer
the byte-code and retrieve a source copy again, it does require more
than just casual computer knowledge to do so.
Note this behavior is outlined in the tutorial page I linked
previously, plus some helpful information about packages, which are a
nice way to organize modules into directories.
-Casey