Greg Ewing wrote: > Ron Adam wrote: > >>There seems to be some confusion as to weather or >>not 'for's will do finalizing. So I was trying to stress I think >>regular 'for' loops should not finalize. They should probably give an >>error if an object with an try-finally in them or an __exit__ method. > > > But if the for-loop can tell whether the iterator > needs finalizing or not, why not have it finalize > the ones that need it and not finalize the ones > that don't? That would be backwards compatible, > since old for-loops working on old iterators would > work as before. > > Greg
Ok, so if they check for it, they might as well handle it. Or maybe they shouldn't even check for performance reasons? Then no error, and it's up to the programmer to decide which looping construct to use. _Ron _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com