Coding in Python

My projects are coded in Python programming language. Python is an open source, object-oriented, scripting language with clear syntax, and the source code is run directly by the Python interpreter. The Python interpreter can be obtained for numerous operating systems, making the code cross-platform, and has an extensive built-in library that can be enhanced by importing extension modules. The following is a brief overview of Python, including what is required to run the programs and some information for those interested in using it for doing their own coding.

To run the Python source code, you need to install the Python interpreter and required extension modules compiled for your operating system. My projects specify the Python version that is required, currently at least version 2.5. Python 3 is available, but due to incomplete backward compatibility and module porting, not currently compatible with my projects. The required extension modules include Pygame multimedia module, which wraps the SDL library, that I use to code the graphics, and NumPy module, a package for scientific computation, that I use to code intensive numeric computations. With Linux, Python is usually installed, and many extension modules are easily installed using the package manager. Other operating systems, including Windows, Python can be easily installed with a downloaded installer. Installers for extension modules are also available for Pygame and NumPy, just ensure to install module packages compiled for the installed Python version.

With the required Python interpreter and extension modules installed, Python programs, typically with the .py extension, can be launched from the file manager if the script is executable or from the command line with the command "python program.py". If there are multiple Python versions installed, you can specify the interpreter to use, for instance "python2.6 program.py" works on my Linux installation, or call the command with its path. I have also create packages of my programs that include the Python interpreter and extension modules that run on both Linux and Windows, using the cx_Freeze packager that I describe in my Python Program Executables post.

Once you have Python installed, you may want to write your own code. If you want examples of programs written in Python and Pygame, you can check my programs, particular my Interphase Pack that contain concise scripts. These scripts also demonstrate my Interphase module that makes it easy to code interface panel functionality and described in my Interphase Module Demo Pack post. The net has numerous documentation, including on the main sites for Python, Pygame, and NumPy, that will aid your coding in Python.

Submitted by Jim on November 18, 2011 at 3:00 pm

This entry was posted in Programming and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.