Making Classes Subclassable

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Tue Jul 5 22:31:07 EDT 2016


On Wednesday, July 6, 2016 at 3:03:26 AM UTC+12, Ian wrote:
>
> On Mon, Jul 4, 2016 at 2:34 AM, Lawrence D’Oliveiro wrote:
>>
>> On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote:
>>> --> "type(obj)" or "obj.__class__" (there are small differences)
>>> give you the type/class of "obj".
>>
>> When would it not be the same?
> 
> I think the only remaining difference in Python 3 is that
> obj.__class__ is assignable and type(obj) is not. For most uses,
> type(obj) would be preferred though, in the same way that len(obj) is
> preferable to obj.__len__().

OK, I think that makes sense.



More information about the Python-list mailing list