Class Type in Python

0 votes

I know that type() function is used to return the class type of parameter.I wrote the below code

class try1 :
  a = 0

print(type(try1()))                        # line 1
print(type(try1))                           # line 2
print(type(type(try1)))                 #line 3
print(type(type(try1())))               #line 4

The output were as follows 

<class '__main__.try1'>
<class 'type'>
<class 'type'>
<class 'type'>

I was able to understand the out of "#line 1 " . But I am not able to get why it is showing class type as 'type' for the other 3 line. Can anyone please explain it to me a bit clearly. I will be very grateful to them.

Thank You


Oct 7, 2021 in Python by Brijesh
• 120 points
358 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

How to get base class type in Python?

Yes, There is an alternative. You can ...READ MORE

answered Feb 8, 2019 in Python by SDeb
• 13,300 points
1,801 views
0 votes
1 answer

Type checking in Python

Use the type() function with the variable ...READ MORE

answered May 8, 2018 in Python by Nietzsche's daemon
• 4,260 points
315 views
0 votes
1 answer

What's the canonical way to check for type in Python?

To check if o is an instance ...READ MORE

answered Aug 24, 2018 in Python by Priyaj
• 58,090 points
697 views
0 votes
1 answer

How does Python know whether a variable in the class is a method or a variable?

In python objects/variables are wrapped into methods ...READ MORE

answered Sep 18, 2018 in Python by aryya
• 7,450 points
955 views
0 votes
1 answer

“stub” __objclass__ in a Python class how to implement it?

You want to avoid interfering with this ...READ MORE

answered Sep 27, 2018 in Python by Priyaj
• 58,090 points
1,863 views
+1 vote
2 answers

Difference: abstract class and interface in Python

If abstract class contains only abstract methods ...READ MORE

answered Jun 21, 2019 in Python by anonymous
7,292 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,069 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP