In article <7xy6x9nzwd....@ruckus.brouhaha.com>,
Paul Rubin  <http://phr...@nospam.invalid> wrote:
>Chris Rebert <c...@rebertia.com> writes:
>>attribution deleted by Paul Rubin:
>>>
>>> class Calculator(): ...
>>
>> Delete the 3 Java-ish accessor methods; good Python style just uses
>> the attributes directly (i.e. self.operator instead of
>> self.getOperator()).
>
>I think I would get rid of the whole Calculator class unless there
>was a good reason to keep it (i.e. you are going to have several
>Calculators active in the program simultaneously).  Just write
>straightforward imperative code without bothering with the OO stuff
>that is mandatory in Java.

IMO "good reason" is simply that using a class makes keeping track of
namespaces easier, e.g. if you add a memory capability.  I think that if
there's clearly an object that you will be manipulating, a class is
usually the right approach even if it doesn't look like it's needed.
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to