I’d like to print the full type of an object
for example:
# 1
print full_type(['a','b','c']) # output: "list of str"
# 2
x = book.objects.filter(user=user) # Django Query Set
print full_type(x) # output: "QuerySet of book"
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.
Container objects in Python can contain any type of object, and even mixed types. This is different from statically typed languages where a container must be declared along with the type of object it contains. It doesn’t really mean anything to ask what the “full type” of an object is in Python. In other words, the only difference between a list instance that contains integers and another instance that contains strings is their contents.
However, if you really want a function to print this out, this will do it: