Is the shortcircuit behaviour of Python's any/all explicit?

后端 未结 4 1563
面向向阳花
面向向阳花 2020-11-28 11:04

Prompted by the discussion here

The docs suggest some equivalent code for the behaviour of all and any

Should the behaviour of the equivalent code be conside

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 11:46

    The behaviour is guaranteed. I've contributed a patch, which was accepted and merged recently, so if you grab the latest sources you will see that the short-circuiting behaviour is now explicitly enforced.

    git clone https://github.com/python/cpython.git
    grep Short-circuit cpython/Lib/test/test_builtin.py
    

提交回复
热议问题