Can I use type as a name for a python function argument?
def fun(name, type):
....
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can, but you shouldn’t. It’s not a good habit to use names of built-ins because they will override the name of the built-in in that scope. If you must use that word, modify it slightly for the given context.
While it probably won’t matter for a small project that is not using
type, it’s better to stay out of the habit of using the names of keywords/built-ins. The Python Style Guide provides a solution for this if you absolutely must use a name that conflicts with a keyword: