[MERGE] versionedfile.py code cleanups
Martin Pool
mbp at sourcefrog.net
Wed Sep 19 12:12:07 BST 2007
On 9/19/07, Ian Clatworthy <ian.clatworthy at internode.on.net> wrote:
> More minor improvements. A trivial question as well for the style gods ...
>
> We commonly use the pattern of having a method foo in a base class that
> does the common stuff (e.g. parameter validation) and then calls to
> method _foo to do the real work. In the base class, _foo simply does this:
>
> raise errors.NotImplementedError(self.foo)
>
> Derived classes are responsible for implementing _foo. Given that,
> should the NotImplementedError take self.foo or self._foo as it's parameter?
I would say self._foo, since that's what's not implemented.
However, I would question whether, by LBYL, we should really be adding
these rather than just letting it hit NameError. If it's the public
method, where we want a docstring in the base class then it has to be
there. I guess the _method may still have a docstring for subclasses.
--
Martin
More information about the bazaar
mailing list