« my running shoes suck | Home | i really really really like python »
August 12, 2005
i really really like python
like perl, it's a little rough around the edges in the packages, and it's still evolving so some neat new modules aren't available on my platforms.
but i wanted to add C-style "#include" capability to some configuration files I had:
if line.find("include") == 0 :
# we allow includes: "include /foo/bar"
try :
# read in the new file
filename = line.split()[1]
self.Read(os.path.expandvars(filename))
except IndexError :
raise BuildConfigurationError(
"Malformed 'include' in %s, line: %d" % \
(filename, linenum))
worked the first time. rad.
plus, I'm really getting the hang of this whole "regular expressions are a LAST RESORT dammit!!" concept.
Leave a comment