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.
The keywords are:
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
On the other hand, built-in functions like id
or type
or str
can be shadowed:
str = "hello" # don't do this