Python compilers?

Stephan Houben stephan at pcrm.win.tue.nl
Mon Sep 27 10:16:00 EDT 1999


On 27 Sep 1999 03:07:27 -0500, Nolan Darilek <nolan at ethereal.dhis.org> wrote:
>I've been programming with C++ for nearly a year, and after seeing how
>other languages are structured, and their benefits, I'm becoming
>disenchanted with it.
>
>So, I've been searching for another language. One item which I would
>like to have, though, is the ability to compile to native code. While
>I completely agree with open source philosophies, I'd like to have the
>option to not release source if, for example, I was working on a game
>and wanted to dissuade the lazy from peeking at the script source for
>the solution. :) I know about freeze, but the created binaries are
>extremely large, which makes sense considering how they are made. :)
>
Well, you could of course code in Perl. 
That will teach them trying to read your code!
<1.5 wink>

>So, are there any native Python compilers? Someone on IRC mentioned a project
>called Viper, and my searches seem to indicate that it is under
>development, but is there any information on the web about its status?

I don't think it's ready for prime time...
and that's probably an understatement.

>One final question. How compatible/cross-platform are Python
>bytecodes? If I wanted to distribute applications in Python while
>hiding the sources from the user, would it be possible to distribute
>.pyc files, or the bytecodes specific to a specific version/platform?
>
Python's .pyc files are completely cross-platform, so you can just
distribute them. However, the bytecode format might change between
versions.

IMHO, you have basically 4 options, in order of diminishing
ease-of-implementation.
1. Don't bother about people reading the source.
   Remember, they are just spoiling their own gaming fun.
   The popular "nethack" game has source available, and yes,
   some people do indeed read it. That's up to them
2. Use CPython and distribute the .pyc files. Make sure that
   you have .pyc files available for all recent Python versions.
   Also note that Python bytecode is relatively easy to disassemble
   and "reverse engineer". Again, people who do that are spoiling
   their own game.
3. Use JPython and distribute the Java .class files. I think there
   are event .class -> C converters. This doesn't buy you anything
   speedwise compared to plain CPython, but it gives you more
   obfuscation. 
4. Have the "meat" of the program run on a server under your control,
   and only distribute a client that connects to the server program.
   This is the only setup that is *really* safe, but it's going to
   be a big hassle both for you and your players. Only do this if
   you offer a monetary prize when winning the game.


Greetings,

Stephan




More information about the Python-list mailing list