On 11/27/2012 07:27 PM, Steven D'Aprano wrote:
> For something as simple as Least Common Multiple? Using a function is > much more sensible than writing a class. > > OOP is for when you have a single data type that needs *state* and > *behaviour*. A LCM function only has behaviour, and so a function is > best. > > If you have code that never needs to store its current state, then a > simple function is probably best. If you have code that does store the > current state, then OOP is probably best. Do you understand what I mean > by "current state"? > I see. Yes, current state should refer to an object's location, heading, speed (if in motion), state of at-rest, etc.? That explains much. Without a state, LCM is not a good candidate as a Class object...unlike, say, a circuit??? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor