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

Wojciech Muła wojciech_mula at poczta.null.onet.pl.invalid
Sat Jan 2 11:41:20 EST 2010


VanceE <vnewel at invalid.invalid> wrote:

> for x in []:
>     assert type(x) == type(())
> 
> I expected an AssertionError but get no errors at all.
> Any explaination?

[] is an empty sequence, so your loop executes exactly 0 times. :)

for x in [None]:
	assert ...

w.



More information about the Python-list mailing list