为什么我能够使用Python 2.7.9 将Python关键字指定True为等于Python关键字False?
Python 2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>> True
True
>>> True = False
>>> True
False
>>>
Run Code Online (Sandbox Code Playgroud)
但是当切换到Python 3.4.3时:
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>> True = False
File "<stdin>", line 1
SyntaxError: can't assign to keyword
>>>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
207 次 |
| 最近记录: |