basedpyright
basedpyright copied to clipboard
reportCallInDefaultInitializer should allow calls to constructors of immutable types
Description
In the above example it would be nice if foo didn't report reportCallInDefaultInitializer. More generally, it'd be nice if constructors for immutable objects (e.g., frozen dataclasses) didn't report.
This is in line with pycharm which seems to understand the immutability of frozenset and frozen dataclasses in the default argument position.
I've thought about this before, but since the documentation for this rule seems to be more concerned about performance rather than mutability, it might make sense to instead split it into two separate rules