[Tutor] Concept related to python classes

Richard Damon Richard at Damon-Family.org
Mon Sep 7 19:02:49 EDT 2020


On 9/7/20 4:52 PM, David Rock wrote:
> * Richard Damon <Richard at Damon-Family.org> [2020-09-07 16:48]:
>> There is also the suggestion I have heard that a class with two methods,
>> one being __init__, and one computing a result is often better as just a
>> function (unless you need the object as a scratch pad for some reason)
> That may be, but doing it as a class allows for easy expansion.  What happens
> when calculating the perimeter becomes necessary?  If it's a class, the
> framework is already there.
>
One of his points was don't and unnecessary frameworks until you know
that you will need them.

The framework to add the class is fairly easy to add if/when you need
it. But a lot of things (like all those getters and setters) aren't
going to be needed even if at first you think it might.

-- 
Richard Damon



More information about the Tutor mailing list