namespace issue, Python vs numpy min/max problem

dmitrey dmitrey.kroshko at
Sat Nov 13 20:41:09 CET 2010

hi all,
I have the following problem:
I have overloaded "max" function in my module (FuncDesigner); it works
like following:
if some data in arguments is of type "oofun" then my function works,
elseware numpy.max() is used.

Now the problem:
suppose someone writes
from FuncDesigner import *
a = max(0,1)

so it calls FuncDesigner, it calls numpy.max and result is 0 (because
in numpy it means "max of array with single element 0 along 1st
But if user has not imported numpy then he expected calling ordinary
Python max and thus result to be "1".

Is there any way to get rid of the problem (somehow automatically
determine which func should be used - numpy or Python max)? The same
issue with "min", but they are equivalent, of course.

More information about the Python-list mailing list