Reputation: 169
Just a quick question: Is 'bin' a keyword in Python? It didn't show up on the keywords lists I found on Google. But when I try to name a variable bin, it shows up in purple.
Thanks
Upvotes: 0
Views: 267
Reputation: 74655
bin
is a builtin function. In the default color scheme in IDLE, builtins are purple #900090, and keywords are orange #ff7700.
Upvotes: 0
Reputation: 15877
Iain is quite right, bin
is a built in function. Different syntax highlighters might show that differently; some only have the category of keywords, and then the highlighter author has to choose between not highlighting builtins or showing them the same as keywords. The Python Language Reference lists the actual keywords, while the library reference lists built-in functions, constants and types, which can be shadowed by names stored in your own name spaces. Doing so is usually regarded as poor form, e.g. if you name a variable list
, it would be harder to reference the list type, a reader might think you did when you were accessing your variable, and it doesn't say what the variable is for (list of what).
Upvotes: 4