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

2010-01-02 Thread VanceE
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Thx (Was: assert type([]) == type(()) )

2010-01-02 Thread VanceE
A big Thank You to all for the answer (and the hints).
That sure explains a lot.

Again, Thank you very much.

Cheers,
 Vance
-- 
http://mail.python.org/mailman/listinfo/python-list