是的,这是官方的:
for_stmt ::= "for" target_list "in" expression_list ":" suite
["else" ":" suite]
> The target list is not deleted when the loop is finished
http://docs.python.org/reference/compound_stmts.html#for
请注意,后面的目标列表for
远不只是变量:
for some_list[blah] in...
for some_object.foo in...
for a[:n] in ...:
等。这些事情不能在循环之后简单消失。