Why is n.__name__ an attribute error when type(n).__name__ works?

Viewed 686
n = 20
print n.__name__

I am getting an error as n has no attribute __name__:

AttributeError: 'int' object has no attribute '__name__'

But n is an instance of the int class, and int.__name__ gives a result, so why does n.__name__ throw an error. I expected that because n is an instance of class int, it should have access to all attributes of that class.

1 Answers
Related