basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

reportCallInDefaultInitializer should allow calls to constructors of immutable types

Open jennifgcrl opened this issue 10 months ago • 1 comments

Description

playground

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.

jennifgcrl avatar May 06 '25 10:05 jennifgcrl

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

DetachHead avatar May 06 '25 15:05 DetachHead