Python 'any()' buildt-in function evaluation sequence -
this question has answer here:
is there guaranteed evaluation sequence 'any()' built-in function? is, safe assume
any([..., x, ... y, ...])
will check condition 'x' before 'y' 'x' listed before 'y'?
note, question on 'is shortcircuit behaviour of python's any/all explicit?' deals 'short-circuit behavior'. not deal evaluation sequence!
please, provide proof/reference suggested statements.
it depends on iterable itself. if ordered (ie list) yes.
if isn't ordered (ie dictionary) not.
what guaranteed evaluation stop when first true
-ish value reached.
Comments
Post a Comment