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

VanceE vnewel at invalid.invalid
Sat Jan 2 17:27:48 CET 2010


Just curious.

type([]) == type(())
is False as expected

and 

assert type([]) == type(())
throws an AssertionError as expected.

However the following is not an error

for x in []:
    assert type(x) == type(())

I expected an AssertionError but get no errors at all.
Any explaination?

BTW I'm using Python2.5 and tried
type(None) == type(())
which is False as expected.

TIA



More information about the Python-list mailing list