From: Bruce S. <Bru...@nc...> - 2007-12-29 02:19:59
|
Thanks for the suggestion. I'll look into this workaround. Bruce Sherwood Scott David Daniels wrote: > I (Scott David Daniels) wrote: > >> I'm not sure of the overhead here, but could something like this work? >> >> def sqrt(x): >> try: return math.sqrt(x) >> except TypeError: return numpy.sqrt(x) >> > > If it "kinda" works, the following addition to __init__ should work: > > from numpy import (ceil as _n_ceil, cos as _n_cos, cosh as _n_cosh, > exp as _n_exp, fabs as _n_fabs, floor as _n_floor, > fmod as _n_fmod, frexp as _n_frexp, hypot as _n_hypot, > ldexp as _n_ldexp, log as _n_log, log10 as _n_log10, > modf as _n_modf, sin as _n_sin, sinh as _n_sinh, > sqrt as _n_sqrt, tan as _n_tan, tanh as _n_tanh) > from math import (ceil as _m_ceil, cos as _m_cos, cosh as _m_cosh, > exp as _m_exp, fabs as _m_fabs, floor as _m_floor, > fmod as _m_fmod, frexp as _m_frexp, hypot as _m_hypot, > ldexp as _m_ldexp, log as _m_log, log10 as _m_log10, > modf as _m_modf, sin as _m_sin, sinh as _m_sinh, > sqrt as _m_sqrt, tan as _m_tan, tanh as _m_tanh) > def ceil(x): > try: return _m_ceil(x) > except TypeError: return _n_ceil(x) > def cos(x): > try: return _m_cos(x) > except TypeError: return _n_cos(x) > def cosh(x): > try: return _m_cosh(x) > except TypeError: return _n_cosh(x) > def exp(x): > try: return _m_exp(x) > except TypeError: return _n_exp(x) > def fabs(x): > try: return _m_fabs(x) > except TypeError: return _n_fabs(x) > def floor(x): > try: return _m_floor(x) > except TypeError: return _n_floor(x) > def fmod(x): > try: return _m_fmod(x) > except TypeError: return _n_fmod(x) > def frexp(x): > try: return _m_frexp(x) > except TypeError: return _n_frexp(x) > def hypot(x): > try: return _m_hypot(x) > except TypeError: return _n_hypot(x) > def ldexp(x): > try: return _m_ldexp(x) > except TypeError: return _n_ldexp(x) > def log(x): > try: return _m_log(x) > except TypeError: return _n_log(x) > def log10(x): > try: return _m_log10(x) > except TypeError: return _n_log10(x) > def modf(x): > try: return _m_modf(x) > except TypeError: return _n_modf(x) > def sin(x): > try: return _m_sin(x) > except TypeError: return _n_sin(x) > def sinh(x): > try: return _m_sinh(x) > except TypeError: return _n_sinh(x) > def sqrt(x): > try: return _m_sqrt(x) > except TypeError: return _n_sqrt(x) > def tan(x): > try: return _m_tan(x) > except TypeError: return _n_tan(x) > def tanh(x): > try: return _m_tanh(x) > except TypeError: return _n_tanh(x) > > --Scott David Daniels > Sco...@Ac... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |