Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
インクリメント演算子 ++ は Python でサポートされていないため、変数の前に付けるときにエラーが発生しないのはなぜですか。例:
i = 3 ++i
対話型コンソールに 3 を出力します。何故ですか?
見てください - それはただのサインです:
>>> i = 3 >>> +i 3 >>> ++i 3 >>> +++i 3 >>> -i -3 >>> --i 3 >>> ---i -3
Python は++iとして扱い+(+i)ます。これは正常にコンパイルされ、 of と同じ値を出力しiます。
++i
+(+i)
i