« 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

About this Entry

This page contains a single entry by sainttoad published on August 12, 2005 10:45 PM.

my running shoes suck was the previous entry in this blog.

i really really really like python is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.