Difference between create instance of an objects by () and without parentheses?
Assume this is my simple class:
class ilist(list):
t1 = "Test1"
t2 = "Test2"
And making the instances to this two variables:
list1 = ilist()
list2 = ilist
When print the two instances
>>> list1
[]
>>> list2
<class '__main__.ilist'>
I can successfully access their attributes
>>> list1.test1
'Test1'
>>> list2.test1
'Test1'
And it shows error in list2 using a method append
>>> list1.append("Item1")
>>> list2.append("Item1")
Traceback (most recent call last):
File "<pyshell#64>", line 1, in <module>
list2.append("Item1")
TypeError: descriptor 'append' requires a 'list' object but received a 'str'
What is the difference not only in this simple example?