type(3,) returns the int type, while
t = 3,
type(t)
returns the tuple type.
Why?
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.
Inside the parentheses that form the function call operator, the comma is not for building tuples, but for separating arguments. Thus,
type(3, )is equivalent totype(3). An additional comma at the end of the argument list is allowed by the grammar. You need an extra pair of parens to build a tuple: