id是python中的关键字吗? [英] Is `id` a keyword in python?
本文介绍了id是python中的关键字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的编辑器(TextMate)用其他颜色(当用作变量名时)显示id
,而不是通常的变量名.是关键字吗?我不想给任何关键字加上阴影...
My editor (TextMate) shows id
in an other colour (when used as variable name) then my usual variable names. Is it a keyword? I don't want to shade any keyword...
推荐答案
id
is not a keyword in Python, but it is the name of a built-in function.
关键字是:
and del from not while
as elif global or with
assert else if pass yield
break except import print
class exec in raise
continue finally is return
def for lambda try
关键字是无效的变量名称.以下将是语法错误:
Keywords are invalid variable names. The following would be a syntax error:
if = 1
另一方面,诸如id
或type
或str
的内置函数可以被遮盖:
On the other hand, built-in functions like id
or type
or str
can be shadowed:
str = "hello" # don't do this
这篇关于id是python中的关键字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文