May-26-2018, 08:27 PM
May-27-2018, 03:58 AM
Of course everything is an object, no doubt about that!!! "
That's exactly why I don't get the difference you make between instances of classes and instances of objects...
That's exactly why I don't get the difference you make between instances of classes and instances of objects...
May-27-2018, 04:32 AM
(May-27-2018, 03:58 AM)buran Wrote: [ -> ]Of course everything is an object, no doubt about that!!! "
That's exactly why I don't get the difference you make between instances of classes and instances of objects...
Does "object of un-instantiated class" sounds better? If that is still unclear
Output:In [31]: type(list().__class__)
Out[31]: type
In [32]: type(dict().__class__)
Out[32]: type
In [33]: type('abc'.__class__)
Out[33]: type
Classes itself are objects of type .... type
, which is a trinity 
Even if object is un-hashable, the class of that object will be always hashable (unless you implement some crazy hack that will make it unhashable - if that is possible). Again, look at my code: I was not saving objects in a set - I was saving classes
PS Maybe, a little demonstration will help
Output:In [37]: class A:
...: def __init__(self, name):
...: self.name = name
...:
In [38]: set([A('volcano63').__class__, A('buran').__class__, A('sonicblind').__class__])
Out[38]: {__main__.A}
May-27-2018, 05:44 AM
(May-27-2018, 04:32 AM)volcano63 Wrote: [ -> ]Does "object of un-instantiated class" sounds better?Yes, now I see what you mean