problem : test a type

polux polux2001 at wanadoo.fr
Sun Aug 25 19:57:32 EDT 2002


I'd like to test if an item in dir(math) is a function, but it doesn't 
work :




 >>> import math
 >>> math.cos
<built-in function cos>
 >>> math.cos==<built-in function cos>
SyntaxError: invalid syntax
 >>> math.cos=='built-in function cos'
0
 >>>



I've tried with "type", it doens't work better
the only way I found to do this is to use srt(math.item) and then test

Can I do it differently ?

(PS excuse my poorenglish)




More information about the Python-list mailing list