Bruno Desthuilliers wrote: > Carl Banks a écrit : > > Bruno Desthuilliers wrote: > > > >>There are less risk of a typo with "if a:" than with "if len(a) > 0". > > > > > > So, it's more important to protect against typos than subtle bugs? > > > > People making smart points are really annoying... !-) > > wrt/ to the "subtle bug" point, MHO is that a better solution could be > to have iterators/generators implement __nonzero__ the same way numpy > arrays do. It may not be a very strong argument, but I actually like the > fact that empty sequences eval to false just like numeric zeros and None...
Well, I certainly can agree with that, except for the last point. :) I certainly wouldn't want to keep that unfortunate behavior around just I have something to use as an argument using len to test emptiness. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
