Closed opk12 closed 7 months ago
Adding better type deduction to Refurb has been on my radar for a while, including better detection of Sequence
and Mapping
types. Currently I only check for builtin list
/tuple
types for Sequence
, and dict
types for Mapping
. Even then, Refurb doesn't fully detect types in a lot of cases.
So yes, this is in the works. I'll keep you posted on any typing related updates.
With the v2 release of Refurb we are able to better detect types, but not all types that extend Sequence
and Mapping
.
I'd say we're halfway there, once we can detect the base class(es) for a given class we can probably close this!
Overview
Would it make sense to advise the most general possible parameter type for a public API? Sometimes you take a list or dict, when you are actually using the members of Sequence or Mapping.
Proposal
I'm not experienced enough with Python to know if the additional noise is actually worth it in practice, or if it is in-scope for Refurb, sorry if this isn't the case.