Attributes (+Numerical Python)

Alex cut_me_out at hotmail.com
Fri Apr 14 15:42:53 EDT 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