On 2010-01-02, VanceE <vne...@invalid.invalid> wrote: > for x in []: > assert type(x) == type(()) > > I expected an AssertionError but get no errors at all. > Any explaination?
That loop never runs. It immediately raises a StopIteration and the body is never executed. cf. for x in []: print "In loop body" You won't see anything printed. OTOH, look at this one: for x in [[]]: # a list containing an empty list assert type(x) == type(()) That will raise the AssertionError as expected. -- Josh "dutchie" Holland <j...@joshh.co.uk> http://joshh.co.uk http://twitter.com/jshholland http://identi.ca/jshholland -- http://mail.python.org/mailman/listinfo/python-list