Justin you're a bad influence, (it's good to see someone meeting their
goals)
#!/usr/bin/env python
from random import choice
class PerlArgumentStore:
"""singleton class, wraps a dictionary of why !perl"""
def __init__(self, filename):
f = open(filename,'r')
d = f.readlines()
self.data = eval(d) #this is cracked, fix later
f.close()
def GetArgument(self,reason):
"""returns dictionary entry, reason is optional
and do we expect perl maniacs to be reasonable?"""
if reason:
return self.data['reason']
else:
return self.data[ choice(self.data.keys()) ]
if __name__=='__main__':
p = PerlArgumentStore('args.dic')
while 1:
q = raw_input('gimme a reason:')
p.GetArgument(q) # ha , in rl do filtering on inputs
---
to run simply create a dictionary file with a python dictionary
of arguments ie. {'key':'value', ...}
maybe you want to have a look at this:
www.python.org/doc/Humor.html#zen
http://www.efn.org/~laprice ( Community, Cooperation, Consensus
http://www.opn.org ( Openness to serendipity, make mistakes
http://www.efn.org/~laprice/poems ( but learn from them.(carpe fructus ludi)
http://allie.office.efn.org/phpwiki/index.php?OregonPublicNetworking