optional pass? (was Re: Dr. Dobb's Python-URL! - weekly Python news and links (Mar 26))

phil hunt philh at comuno.freeserve.co.uk
Thu Mar 28 14:41:32 EST 2002


On Thu, 28 Mar 2002 19:09:13 +0100, Stefan Schwarzer <s.schwarzer at ndh.net> wrote:
>What about
>
>class BaseClass: pass
>
>class MyClass(BaseClass):
>   def __init__(self): pass
>   def method1(self, a, b, c): pass
>   def method2(self, d, e): pass
>   def method3(self, f): pass
>
>IMHO, that looks almost as well as your version, and makes the absence
>of additional code seem rather intentional, not accidental.

True, but i still have to remove the passes when i want to implement 
the class.

>> And then, when you begin to flesh out your code, you would have to
>> get rid of the extraneous passes you didn't want to add (assuming
>> you are like me) in the first place. So the with-pass version
>> requires more effort, and is more verbose, for no good reason.
>
>I value the explicitness of pass over having to write or delete a bit
>less.

With my proposal, you can still use pass if you want to.

-- 
<"><"><"> Philip Hunt <philh at comuno.freeserve.co.uk> <"><"><">
"I would guess that he really believes whatever is politically 
advantageous for him to believe." 
                        -- Alison Brooks, referring to Michael
                              Portillo, on soc.history.what-if



More information about the Python-list mailing list