|
33 | 33 |
|
34 | 34 | >>> None = 1 |
35 | 35 | Traceback (most recent call last): |
36 | | -SyntaxError: cannot assign to None |
| 36 | +SyntaxError: cannot assign to reserved keyword 'None' |
37 | 37 |
|
38 | 38 | >>> obj.True = 1 |
39 | 39 | Traceback (most recent call last): |
40 | 40 | SyntaxError: invalid syntax |
41 | 41 |
|
42 | 42 | >>> True = 1 |
43 | 43 | Traceback (most recent call last): |
44 | | -SyntaxError: cannot assign to True |
| 44 | +SyntaxError: cannot assign to reserved keyword 'True' |
| 45 | +
|
| 46 | +>>> class = "Mammalia" |
| 47 | +Traceback (most recent call last): |
| 48 | +SyntaxError: cannot assign to reserved keyword 'class' |
| 49 | +
|
| 50 | +>>> lambda = "λ" |
| 51 | +Traceback (most recent call last): |
| 52 | +SyntaxError: cannot assign to reserved keyword 'lambda' |
45 | 53 |
|
46 | 54 | >>> (True := 1) |
47 | 55 | Traceback (most recent call last): |
|
190 | 198 |
|
191 | 199 | >>> True = True = 3 |
192 | 200 | Traceback (most recent call last): |
193 | | -SyntaxError: cannot assign to True |
| 201 | +SyntaxError: cannot assign to reserved keyword 'True' |
| 202 | +
|
| 203 | +>>> class = True = 3 |
| 204 | +Traceback (most recent call last): |
| 205 | +SyntaxError: cannot assign to reserved keyword 'class' |
194 | 206 |
|
195 | 207 | >>> x = y = True = z = 3 |
196 | 208 | Traceback (most recent call last): |
|
810 | 822 | SyntaxError: expression cannot contain assignment, perhaps you meant "=="? |
811 | 823 | >>> f(True=1) |
812 | 824 | Traceback (most recent call last): |
813 | | -SyntaxError: cannot assign to True |
| 825 | +SyntaxError: cannot assign to reserved keyword 'True' |
814 | 826 | >>> f(False=1) |
815 | 827 | Traceback (most recent call last): |
816 | | -SyntaxError: cannot assign to False |
| 828 | +SyntaxError: cannot assign to reserved keyword 'False' |
817 | 829 | >>> f(None=1) |
818 | 830 | Traceback (most recent call last): |
819 | | -SyntaxError: cannot assign to None |
| 831 | +SyntaxError: cannot assign to reserved keyword 'None' |
820 | 832 | >>> f(__debug__=1) |
821 | 833 | Traceback (most recent call last): |
822 | 834 | SyntaxError: cannot assign to __debug__ |
|
0 commit comments