assert type([]) == type(())

Jan Kaliszewski zuo at chopin.edu.pl
Sat Jan 2 11:51:58 EST 2010


> However the following is not an error
>
> for x in []:
>     assert type(x) == type(())

Trying to iterate over an empty sequence or iterator causes
0 (zero) steps of iteration -- so above assert statement is
never run.

Cheers,
*j

-- 
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>



More information about the Python-list mailing list