Attributes (+Numerical Python)

Matthew Hirsch meh9 at cornell.edu
Fri Apr 14 15:15:58 EDT 2000


Hi All,

In Numerical Python, you can say something like vector.imag and it will 
return arrays of the imaginary parts of the elements in the array, 
vector.  But this attribute only exists when the array is complex.  I'd 
like to do something like the following, but I have no idea what the 
syntax should be:

if the .imag attribute exists:
   do something
else
   do something else

How should this be written?

Thanks for your help,
Matt



More information about the Python-list mailing list