How can I verify that a passed argument is an interible collection?

Diez B. Roggisch deetsNOSPAM at web.de
Thu Apr 21 11:06:07 EDT 2005


Charles Krug wrote:

> List:
> 
> I'm working on some methods that operate on (mathematical) vectors as
> in:
> 
> def Convolution(x, y)
> """Returns a list containing the convolution of vectors x and y"""
> 
> Is there any way to determine at runtime that x and y are iterible
> collections?
> 
> Do I *coughs* simply *coughs* trap the exception created by:
> 
>     for v in x:
> 
> when v is a scaler quantity?

Yes, thats considered good practice. 
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list