data icon indicating copy to clipboard operation
data copied to clipboard

[RFC] Remove the need for super().__init__() call in BaseNode subclasses to better support dataclasses

Open andrewkho opened this issue 1 year ago • 0 comments

🚀 The feature

Stop requiring BaseNode implementations to call super().init()

Motivation, pitch

Currently we require users to call super().init() but this can't be done easily with dataclasses, except in post_init. See eg nn.Module:

image

Alternatives

We could just leave it as-is, since DataClasses have a viable workaround with __post_init__. Right now we're only setting up a flag but it may be useful for other things in the future, such as registration with a global thread executor. Alternatively we could use a Loader wrapper class to register with an executor.

Additional context

No response

andrewkho avatar Dec 18 '24 18:12 andrewkho