Chronology | Current Month | Current Thread | Current Date |
[Year List] [Month List (current year)] | [Date Index] [Thread Index] | [Thread Prev] [Thread Next] | [Date Prev] [Date Next] |
Then I saw what was, in my mind, the simplest example that showed a
clear advantage. It is a class, from the Python Cookbook, which does
temperature conversions
(http://code.activestate.com/recipes/286226-temperature-class/).
The advantage is that, in this implementation, you only have to know
how to convert to and from Kelvin from whatever units you're using.
In a procedural program (like C), you'd have to have all of the
different combinations (c to f, c to r, r to f, etc...) which is
clearly less efficient.