Scott Hurring » Code » Python » Simple list processor

Download Code
download
list_processor_v0.1.tgz
v0.1 alpha · Sep 11, 2004
(browse code)

Description

I decided last week to start learning Python, partly becuase of all the good things i've read from hacker-type people and partly becuase it just seems to be a very interesting langauge with lots of features that i find really intersting. (and AFAIK are not present in PHP or Perl in any meaningful way)

So as an exercise, becuase i was reading about Lisp the other nite, i wanted to write a simple program in Python that would do prefix math list-processing type stuff. So, for example (+ 5 (- 4 2)) would be parsed as the mathematical expression 5+(4-2) and return 7

But as i was writing the program, i realized that becuase functions are handled like variables in python, you could essentially write a processor that would take (Something n1 n2 n3 ...) and have the Python code instantiate the class Something and pass into it the arguments n1, n2, n3, ... and basically you'd be free to have class Something do anything that you could code in python.

My plans for the code here is to try and keep extending this program by figuring out how to have variables setup and how to let the input text define functions dynamically. Also, i'd like have python be able to dynamically figure out which class to initialize based on the input keyword, rather than me having to tell it explicitly (in function decode(): if value == "Something": return Something.


Download

v0.1 - Sep 11, 2004

Changelog / History

v0.1 - Initial release: Sep 11, 2004