Links
Python
PythonLabs
 
Email Us
jeremy@beopen.com
  

Python code

  • urllib2.py
  • monitor.py
  • ping and traceroute
  • zip files

A Python Compiler

I am working on a set of compiler and program analysis tools for Python. The initial result is a simple Python-to-bytecode compiler written in Python. The code it produces is nearly the same as the code produced by compile.c in the Python distribution. The key difference is that it is written in Python and easier to maintain and extend.

You can get the compiler through the Python CVS server under python/nondist/src/Compiler. There are instructions for access via CVS.

The Python Compiler SIG is a forum for discussing this sort of work.

urllib

urllib2.py

I am working on a replacement for urllib, which is part of the Python standard library. I'm currently calling it urllib2, but only because I'm not any good at coming up with names.

monitors

monitor.py

Python 1.5 introduced the threading module, which provides an threads interface that is close to Java's thread API. The interface does not directly support monitors or synchronized methods. I think this lack is largely the result of having no way to say "synchronized" in Python; there are no declarations in Python, so there is now where to add the modifier.

My monitor object is a base class that automatically creates synchronized methods based on the names of methods in classes that inherit from it. Instead of adding a "synchronized" modifier, you preface the method name with "entry_". When instances are actually created, the synchronized methods will be added without the "entry_" prefix.

It may be profitable -- stylish, certainly -- to re-write the functor version using Michael Hudson's bytecodehacks module.

Grail

A Web browser written in Python and Tk. An old project.

zip files

Jim Ahlstrom is working on a ZIP file support to be included in Python 1.6. I am (well, was -- and would like to again) working on a module for reading and writing ZIP files. Not sure what it's release status will be. Send me mail if you're interested.

ping and traceroute

ping.tar.gz

Some simple-minded code for manipulating raw IP, ICMP, and UDP packets. They allow you to write ping and traceroute completely in Python; the code is smaller and simpler than the corresponding C versions (e.g. traceroute.c). The code was written for Python 1.4; it should be updated to use the new features of the struct module in 1.5.