Skip to content
Advertisement

Is it safe to use the python word “type” in my code?

Can I use the word type in my own code or is it reserved? My function header:

JavaScript

Advertisement

Answer

Using type as a keyword argument to a function will mask the built-in function “type” within the scope of the function. So while doing so does not raise a SyntaxError, it is not considered good practice, and I would avoid doing so.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement