>> so I think it does make sense to bring the common names that show up in
>> math expressions into the main namespace.>> This is probably best just done by each individual according to his/her
>> taste.
>
> That's what I'm trying to get away from. I want to be able to write
> the contains() function in patch.py and just use the normal math where
> it makes sense to use normal math.Ahh -- we're back on an a mpl-devel topic now.
I was thinking that you were proposing a "math" namespace for pylab
users -- but it sounds like you're proposing a standard set of math
names that will be brought in to modules for the matplotlib project
itself. Different issue.
Through the use of "from mpl.math import *" yes.
I don't write enough MPL internal code to have any opinion on that.
I'll let the code speak for itself:
~/src/matplotlib/lib/matplotlib pkienzle$ for sym in $symlist; do
echo `grep "[^A-Za-z0-9_]$sym[^A-Za-z0-9_]" *.py | wc -l` $sym;
done | sort -n -r | column -c 75
163 max 7 remainder 1 cosh 0 isnormal
136 arg 7 pow 1 arctanh 0 isinf
109 min 7 inf 1 arcsinh 0 isfinite
102 log 6 arctan2 1 arccosh 0 frexp
64 pi 5 fabs 0 trunc 0 fmin
56 sqrt 4 imag 0 tgamma 0 fmax
44 abs 3 tan 0 signbit 0 fdim
38 sin 3 nan 0 scalbn 0 expm1
28 cos 3 log2 0 rint 0 exp2
23 minimum 3 hypot 0 remquo 0 erfc
22 round 2 isnan 0 nexttoward 0 erf
19 maximum 2 arctan 0 nearbyingt 0 cproj
19 floor 2 arcsin 0 modf 0 copysign
18 log10 2 arccos 0 logb 0 conj
18 ceil 1 tanh 0 log1p 0 cbrt
13 real 1 sinh 0 lgamma 0 NaN
12 exp 1 fmod 0 ldexp 0 Inf
I used the following list:
symlist=`cat <<EOF
pi inf Inf nan NaN
isfinite isnormal isnan isinf
arccos arcsin arctan arctan2 cos sin tan
arccosh arcsinh arctanh cosh sinh tanh
exp log log10 expm1 log1p exp2 log2
pow sqrt cbrt erf erfc lgamma tgamma hypot
fmod remainder remquo
fabs fdim fmax fmin
copysign signbit frexp ldexp logb modf scalbn
ceil floor rint nexttoward nearbyingt round trunc
conj cproj abs arg imag real
min max minimum maximum
EOF`
This measure doesn't distinguish between comments and
code, but it should still be good enough for the purposes
of this discussion. Tuning the list to the set of functions
available in numpy rather than c99 would help (I did rename
ayyy to arcyyy for the trig functions).
- Paul
···
On Fri, Jul 20, 2007 at 05:05:40PM -0700, Christopher Barker wrote: