くだすれPython(超初心者用) その23
■ このスレッドは過去ログ倉庫に格納されています
0396デフォルトの名無しさん
2014/06/28(土) 08:54:24.83ID:2sHahEvaちがう
https://docs.python.org/3/reference/simple_stmts.html#assignment-statements
> assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)
>
> An assignment statement evaluates the expression list (remember that this can be
> a single expression or a comma-separated list, the latter yielding a tuple) and
> assigns the single resulting object to each of the target lists, from left to right.
a = b = 1 ってあったら a と b が target_list
でもってリテラル 1 を評価して得られたオブジェクトをまず a に代入し、続いて b に代入する
Python の代入が値を返さないことからくる仕様
■ このスレッドは過去ログ倉庫に格納されています