The ops module is an autogenerated file. The code in bytecodehacks.code_gen is responsible for generating this file.
There is a tiny script in bytecodehacks/code_gen/regen that regenerates ops.py. I have a symlink to it on my $PATH; you may want to do the same if you're hacking on bytecodehacks.
write_ops does most of the legwork, using method_spec.
The code isn't pretty or very general, but it works well enough. I hope it's also fairly easy to understand, because I don't feel like writing detailed documentation right now...
Send comments to mwh@python.net