While testing Psyco V2 to see if it would offer any speed improvements I tried it with some applications using matplotlib. Exceptions were raised that were easily resolved by replacing calls to min() and max() with their numpy equivalents numpy.amin() and numpy.amax() in the matplotlib code.
Simply demonstrated by inserting at the beginning of, say, matplotlib's examples/api/barchart_demo.py :
Traceback (most recent call last):
File "barchart_demo.py", line 29, in <module>
File "c:\python26\lib\site-packages\matplotlib\axes.py", line 2064, in set_xticks
return self.xaxis.set_ticks(ticks, minor=minor)
File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1154, in set_ticks
File "c:\python26\lib\site-packages\psyco\builtin.py", line 75, in min
File "c:\python26\lib\site-packages\psyco\builtin.py", line 34, in _min
if not iterable:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psyco
(2, 0, 0, 'final', 0)
>>> import numpy
>>> import matplotlib
Psyco V2 is available from: http://codespeak.net/svn/psyco/v2/dist/
Should numpy.min()/numpy.amin() be used on array like objects within matplotlib, or is min() adequate ? Ditto max().
(Out of interest I came across numpy ticket #1286 while looking for this issue.)