[Numpy-discussion] Where does _assert_func come from.

Charles R Harris charlesr.harris@gmail....
Thu Aug 28 20:39:02 CDT 2008


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

> On Thu, Aug 28, 2008 at 5:26 PM, Charles R Harris
> <charlesr.harris@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://projects.scipy.org/pipermail/numpy-discussion/attachments/20080828/ddafd494/attachment.html 


More information about the Numpy-discussion mailing list