__new__ and __init__ - why does this work?

Steve D'Aprano steve+python at pearwood.info
Wed Aug 9 11:19:32 EDT 2017


On Thu, 10 Aug 2017 12:39 am, Dennis Lee Bieber wrote:

> On Wed, 09 Aug 2017 22:54:00 +1000, Steve D'Aprano
> <steve+python at pearwood.info> declaimed the following:
> 
>>Its not just frozenset. Any mutable class must initialise its instances in
>>__new__. Immutable classes can use either __new__ or __init__, but for
>>historical reasons typically use __init__.
>>
> Think you swapped mutable and immutable there...


Doh! So I did.

This is what happens when you try typing a response while caring on a
conversation with the missus...



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list