[Numpy-discussion] Where does _assert_func come from.

Charles R Harris charlesr.harris at gmail.com
Thu Aug 28 21:39:02 EDT 2008


On Thu, Aug 28, 2008 at 6:48 PM, Fernando Perez <fperez.net at gmail.com>wrote:

> On Thu, Aug 28, 2008 at 5:26 PM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> > Where does _assert_func come from in this fragment from a test class?
> >
> > class _GenericTest(object):
> >     def _test_equal(self, a, b):
> >         self._assert_func(a, b)
> >
> > I hope it isn't monkey patched in.
>
> It could be meant as a mix-in, case in which it would be ok for the
> class to be incomplete as written.  A bit surprising, but not
> necessarily incorrect.
>
> If it's not meant to be a base/mix-in class, then it's a good ole'bug.
>

Turns out it's defined in a derived class, which I suppose makes it a mix-in
class. Looks kinda like the python version of pure virtual functions in C++
base classes. It's a bit surprising to see a python pattern that's more
obscure than C++ ;) I'm not sure I like its usage here -- implementation
rather than is a -- but I'm not going to clean it up.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080828/ddafd494/attachment.html>


More information about the NumPy-Discussion mailing list