pyrsistent icon indicating copy to clipboard operation
pyrsistent copied to clipboard

Is it safe to override `__init__` for a `PClass`?

Open travis-leith opened this issue 6 months ago • 1 comments

Currently, PClass exposed constructors of the form MyClass(**kwargs: Any). If I want to support static type checking, I need a factory method. But if I want to prevent people from using the standard constructor, I need to overrde __init__. Is this a safe thing to do or might it break something?

travis-leith avatar May 09 '25 09:05 travis-leith

If pyrsistent were to be rewritten based on dataclasses, would this be a non issue?

travis-leith avatar May 09 '25 09:05 travis-leith