代码拉取完成,页面将自动刷新
2022-3-12
AIL 2.2 带来了更为详细的语法错误信息,并提高了整体的稳定性。
AIL 2.2 版本将开始适配 Python 3.10 的部分功能,源码上会在尽可能兼容 Python 3.7 的基础上进行针对 Python 3.10 的特性的优化。
Python 3.10 版本更新说明: py3.10
新的 AIL 2.2 带来了更为清晰详细的语法错误提示信息。新增加的语法提示包括但不仅限于下面的内容:
新的 AIL 版本中,当出现语法错误时,AIL 将会给出错误的大致位置:
>> a = match x {};
File "<shell>", line 1
a = match x {};
^
SyntaxError: match body cannot be empty
新的 AIL 版本中,将对配对错误的括号给出提示:
>> a = (1, 2];
File "<shell>", line 1
a = (1, 2];
^
SyntaxError: closing parenthesis ']' does not match opening parenthesis '(' (at line 1, col 6)
新的 AIL 版本中,未结束的字符串将会给出更详细的提示详细:
>> name = 'klee
File "<shell>", line 1
name = 'klee
^
SyntaxError: unterminated string literal (detected at line 1)
maptools
模块新增 xmapwith
, traverse
函数。
AIL 2.2 Klee alpha 2 [727] (2.2/d24235a) (Python 3.8.0 (default, Dec 5 2019, 10:53:43)
[Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6)
Type 'help(...)', '$help', 'copyright()', 'python_copyright()' to get more information, 'exit()' to exit.
>>
not in
运算符not in
运算符可以用于快速判断某元素是否存在于一个可迭代对象中:
>> knights_of_favonius = ['Jean', 'Kaeya', 'Eula', 'Amber', 'Rosaria', 'Klee'];
>> 'Klee' not in knights_of_favonius;
False
>> 'Diona' not in knights_of_favonius;
True
>>
>> 1 not in [1, 2, 4, 8, 16];
False
>> 'a' not in 'Jean';
False
>>
注意:
相比于 not ... in ...
表达式,not in
作为一个运算符存在,相比前者,使用 not in
运算符可以提高程序的执行效率。
使用 if-else
三元运算符可以在一个表达式中对值进行选择:
>> passed = true
>> result = 'OK' if passed else 'FAILED'
>> result
OK
x[1][2]
) 的解析问题此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。