A PYTHON PREPROCESSOR

Moshe Zadka moshez at math.huji.ac.il
Thu May 18 01:23:11 EDT 2000


On Thu, 18 May 2000, Courageous wrote:

> 
> I am considering writing a Python preproccesor,
> and I'm wondering if prior work has been done,
> and if there's any collective wisdom or thoughts
> on the concept.

I think the collective wisdom is "don't do this". Not because of
whitespace issues -- these can be dealt with, with some thoughts. It's
because it's not needed -- Python is *so* flexible right now, there's not
much you need macros for. For example, in C you might need:

#ifdef UNIX
#include <unix_header.h>
#else
#include <windows_header.h>
#endif

In Python, similar functionality is via:

try:
	__import__("posix")
except ImportError:
	import windows_module
else:
	import unix_module


--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list