[Python-ideas] Providing a guarantee that instances of user-defined classes have distinct identities

Amaury Forgeot d'Arc amauryfa at gmail.com
Thu Apr 19 15:48:42 CEST 2012


2012/4/19 Simon Sapin <simon.sapin at kozea.fr>

> Le 19/04/2012 14:58, Mike Meyer a écrit :
>
>  On Thu, 19 Apr 2012 11:35:13 +0100
>> Sven Marnach<sven at marnach.net>  wrote:
>>
>>> >  It wouldn't be completely unthinkable that a Python implementation
>>> >  chooses to extend this behaviour to immutable subclasses of immutable
>>> >  types.  I don't think there is any reason to disallow such an
>>> >  implementation either.
>>>
>> How would the implementation determine that the subclass was
>> immutable?
>>
>
> When all classes in the MRO except 'object' have an empty __slots__?
>

But you can still change the __class__ of an object, even immutable ones.

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120419/d869b07a/attachment.html>


More information about the Python-ideas mailing list