New submission from wim glenn: The docs http://docs.python.org/2/library/functions.html#all provide some equivalent code for all builtin (and similarly for any):
def all(iterable): for element in iterable: if not element: return False return True The behaviour is clearly documented as short-circuiting, but the cases contained in test_builtin.py are lacking any test coverage for the short-circuiting behaviour. You could implement any/all in a broken way that still passes the current tests (consuming more of a generator than you want to for example), so it is important to guarantee the short-circuiting. My patch adds two simple test cases to make this behaviour explicit. ---------- components: Tests files: mywork.patch keywords: patch messages: 182496 nosy: wim.glenn priority: normal severity: normal status: open title: test_any and test_all should validate short-circuiting behaviour type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file29131/mywork.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17255> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com