Re: [python.omega] Running Python-Omega on Python 2.6.1
- Tim Allen
- 2014-12-19 @ 07:33
On Tue, Dec 16, 2014 at 01:10:52AM +0000, John Pallister wrote:
> I've been interested in OMeta for a while (and I've started my own
> Common Lisp version, based on Tony Garnock-Jones's Scheme
> implementation) but haven't tried to use it in anger until now.
> A client needs some HTML munged, and they're OK running a Python
> script, but they only have Python 2.6.1 on OS X 10.6.8 at the moment.
> So I'd like to use Omega, and I have Python 2.7.8, but I wanted to ask
> you whether you could definitely say Omega wouldn't run on Python 2.6
> before I start installing old versions for testing.
Omega's biggest issue with portability between Python versions is likely
to be the `ast` standard library module; for example, Python 3.x
supports annotations on function arguments, so when I ported Omega to
Python 3.x I had to fix the code that defined function to pass None for
all the annotations.
The first version of Omega was written with Python 2.7, and I don't
recall *deliberately* making it incompatible with Python 2.6, but
I can't imagine the `ast` module can have changed very much between the
Omega has a pretty decent test suite; try running it on Python 2.6 and
see what happens. :)
> If you think it might work I'll forge ahead and try it out; if it
> definitely won't I'll have to ask the client to upgrade their local
> Python (which hopefully won't be a big deal).
I have to admit, for the specific case of HTML munging I'm hesitant to
suggest writing a custom parser; the contortions browsers go through to
handle real-world HTML are scary. It would be much more practical to use
something like html5lib, which is a pure-Python implementation of the
standard browser parsing algorithm.
> I'm looking forward to getting stuck in to some parsing with Omega!
> Are you still using it much yourself?
I must admit, I haven't really used it 'in anger' yet. When I read about
the OMeta language, I was amazed at how easy it was to express complex
grammars, and I wanted to make sure such an elegant design was properly
available in Python. Having written Omega and all the documentation,
I decided to take a break and got distracted by other things. I'm still
pretty proud of it, though!