Attributes (+Numerical Python)

Alex cut_me_out at hotmail.com
Fri Apr 14 21:42:53 CEST 2000


> if the .imag attribute exists:
>    do something
> else
>    do something else
> 
> How should this be written?

if hasattr (object, 'imag'):
    do something
else:
    do something else

Alex.



More information about the Python-list mailing list