how to overload sqrt in a module?

Michael McNeil Forbes mforbes at lnsDOTmit.edu
Fri Mar 3 01:35:51 EST 2006


>> Are there any other more generic solutions (without having to write
>> "custom" functions like numpy.sqrt)?
>
> No. *Someone* always has to write those "custom" functions. In the case of len()
> and abs(), that someone was Guido. For numpy.sqrt(), that someone was Travis
> Oliphant. For anything else you want, that someone is probably you.

Thanks Guido!  Thanks Travis:-)

What I was thinking was: is there some way to pass a parameter to the 
module on import so that the module can then use the correct environment.

If I could pass a dictionary to the module with all of the overloaded 
functions, then they could become part of the module's environment and 
used appropriately.  I could not find a way of passing such a dictionary.

Michael.



More information about the Python-list mailing list