pre-PEP for optional 'pass'

Steve Holden sholden at holdenweb.com
Wed Apr 17 09:42:40 EDT 2002


"Andy Gimblett" <gimbo at ftech.net> wrote ...
> On Wed, Apr 17, 2002 at 08:33:44AM +0000, Duncan Booth wrote:
>
[example code]
> >
> > I would say that all of these comments could be automatically generated,
> > but if I look at the output of (say) pydoc, they add useful information
as
> > I might otherwise be misled into thinking that the class and methods did
> > something.
>
> We're veering slightly from the original reason for this point, which
> was how to write stub functions/methods which will be implemented
> later.  The above certainly doesn't indicate any intent to actually
> implement the methods (in fact, on the contrary, it suggests they
> could be removed).
>
> How about this?
>
> class MyClass:
>     """Class encapsulating a Twiddle.  Unfinished.  Document me.  XXX"""
>     def __init__(self, x, ,y, z):
>         """Not yet implemented. XXX"""
>     def getTwiddle(self):
>         """Not yet implemented. XXX"""
>     def setTwiddle(self, twiddle):
>         """Not yet implemented. XXX"""
>
> where you can grep for XXX to find unfinished business - very handy.
>
But surely no less handy than, say, the following:

class MyClass:
    """Class encapsulating a Twiddle.  Unfinished.  Document me.  XXX"""
    def __init__(self, x, ,y, z):
        raise NotImplementedError    # XXX
    def getTwiddle(self):
        raise NotImplementedError    # XXX
    def setTwiddle(self, twiddle):
        raise NotImplementedError    # XXX

This also has the merit of not simply (and silently) doing nothing, and can
still be grepped for the necessary change areas. But this thread has now
gone round in circles twice without anyone changing their minds, so at this
point I'll leave it to vanish up its own orifice.

regards
 Steve







More information about the Python-list mailing list