[ot][random][crazy][spam] Out of it, Video Game Design Project

Undiscussed Horrific Abuse, One Victim of Many gmkarl at gmail.com
Mon Feb 14 03:25:12 PST 2022


I switched to python some years ago because:
- it is used by mainstream open source ai research and many hobbyists
- it has language support to reference, mutate, and recompile its own
bytecode while executing it, and has some syntax mutability
- it's concise
There are downsides to python. Notably it is hard to debug interpreter
problems from chip or kernel misbehavior. C is much better in my opinion.

Anyway, I've been using python for some time without understanding __new__,
which is an important construct.

Here's how the manual says __new__ works. It's not complicated.

1. python calls Class.__new__(cls, ...) when Class(...) is called.
2. Unlike all other methods, __new__ is never passed a self object, and
always passed a class object, no matter how it is decorated.
3. The return value of __new__ is passed on to __init__, after __new__
returns, if and only if it is an object of the class. Then it is returned
to the user.
4. New objects can be constructed via super().__new__(cls), to return.

This lets one write constructors that for example instantiate a child class
selected from arguments and perform other tricks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 1506 bytes
Desc: not available
URL: <https://lists.cpunks.org/pipermail/cypherpunks/attachments/20220214/6f286bb2/attachment.txt>


More information about the cypherpunks mailing list