Mar-26-2018, 09:16 AM
I'm learning the __class__ property,but when I try to execute code below,a syntax error raises:
print(1.__class__)
from my opinion,in python,everything is object,so do number 1,this code should give me "class int" back.am i right?
this is another scenario:
print((1,2)[0].__class__)
this code is OK.I think (1,2)[0] is actually number 1,why this code is OK?
print(1.__class__)
from my opinion,in python,everything is object,so do number 1,this code should give me "class int" back.am i right?
this is another scenario:
print((1,2)[0].__class__)
this code is OK.I think (1,2)[0] is actually number 1,why this code is OK?