October 14, 2003
A while ago, I mentioned Dave Thomas' Kata. Well, I've taken the plunge in a vain attempt to stretch my brain and had a bash at his latest. My solution is in Python and doesn't (yet) use generators, but its a good start. The code is here and;
A module trying out Kata Eighteen (http://www.pragprog.com/pragdave/Practices/Kata/KataEighteen.rdoc,v)
For ease of readability I've included the two classes in the same module.
def add_direct(self, item, dependencies):
def dependencies_for(self, item, results=):
for dep in self.dependencies[item]:
if dep not in results:
self.mine = depend()
"Make sure that A depends on B and C"
self.assertEqual(self.mine.dependencies_for('A', ), ['B', 'C', 'A'])
if __name__ == '__main__':
Corrections and comments are, as always, welcome.
Posted by Andy Todd at October 14, 2003 11:14 PM