MOTD

Message Of The Day

Sat, 18 Sep 2004

02:30 [zork(~)] cat python-abuse-1.txt

THINGS THAT HAPPEN

import UserDict,os

class WriteFileCacheDict (UserDict.UserDict):
    def __getitem__ (self, key):
        if not self.data.has_key(key):
            self.data[key] = open (key, 'w+')
        return self.data[key]

class MagicalFileDict (WriteFileCacheDict):
    def __getitem__ (self, key):
        if not self.data.has_key(key):
            d = os.path.dirname(key)
            if not os.path.isdir(d):
                os.makedirs(d)
        return WriteFileCacheDict.__getitem__(self, key)

[zork(~)] cal
[zork(~)] tree
[zork(~)] syndicate.py
[zork(~)] cat README