[SciPy-dev] What is this dispatch thing ?

Robert Kern robert.kern at gmail.com
Thu Jul 20 11:26:06 CDT 2006

David Huard wrote:
> Hi,
> I just updated scipy from svn and stats.linregress(x,y) returns
> /usr/lib/python2.4/site-packages/stats.py in __call__(self, arg1, *args, 
> **kw)
>     244     def __call__(self, arg1, *args, **kw):
>     245         if type(arg1) not in self._types:
> --> 246             raise TypeError, "don't know how to dispatch %s 
> arguments" %  type(arg1)
>     247         return apply(self._dispatch[type(arg1)], (arg1,) + args, kw)
>     248
> TypeError: don't know how to dispatch <type ' numpy.ndarray'> arguments
> Also, in ipython, linregress? returns a doc about the dispatch class. Is 
> this intended ?

That version of stats.py is not from scipy. That version tried to handle lists 
as well as arrays. The functions for each type were wrapped by a dispatching 
class that would call the appropriate version depending on the argument type. 
That version of stats.py was written for Numeric and cannot deal with numpy arrays.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Scipy-dev mailing list