How to use "__new__"?
Terry Reedy
tjreedy at udel.edu
Tue Mar 29 22:06:40 EST 2005
"could ildg" <could.net at gmail.com> wrote in message
news:311b5ce105032917276a188c59 at mail.gmail.com...
> __new__() is intended mainly to allow subclasses of immutable types
> (like int, str, or tuple) to customize instance creation.
Exactly. It is an anwer to the conundrum: How do you give an immutable
object its unchangeable value. It is much like how to move an unmovable
object to its permanent position ;-).
TJR
More information about the Python-list
mailing list