Richard Buckle <[EMAIL PROTECTED]> writes: > Comments, insights and overall evaluations are especially welcomed re: > * Cleanliness of design > * Pythonicity of design > * Pythonicity of code > * Efficiency of code > * Quality of docstrings > * Conformance with modern docstring standards > * Conformance with coding standards e.g. PEP 8 > > I look forward to receiving your comments and criticisms.
I looked at this for a minute and found it carefully written but somewhat hard to understand. I think it's maybe more OOP-y than Python programs usually are; perhaps it's Java-like. There are some efficiency issues that would be serious if the code were being used on large problems, but probably no big deal for "3D6" or the like. In particular, you call histogram.numSamples() in a bunch of places and each call results in scanning through the dict. You might want to cache this value in the histogram instance. Making histogram a subclass of dict also seems a little bit peculiar. You might find it more in the functional programming spirit to use gencomps rather than listcomps in a few places: return sum([freq * val for val, freq in self.items()]) becomes return sum((freq * val) for val, freq in self.iteritems()) etc. -- http://mail.python.org/mailman/listinfo/python-list