bitter-ability-32190
12/10/2022, 7:50 PM@convert_fields
@dataclass(frozen=True)
class Foo:
x: Iterable[int] = convert_field(tuple)
x = Foo(x=[1, 2]) # mypy is happy
reveal_type(x.x) # reveals Iterable[int]
print(type(x.x)) # prints <class 'tuple'>
I'm coming after you frozen_after_init 😈bitter-ability-32190
12/10/2022, 8:02 PMwide-midnight-78598
12/10/2022, 8:25 PMbitter-ability-32190
12/10/2022, 8:31 PMIterable and the value type is tuple or Sequencebitter-ability-32190
12/10/2022, 8:33 PMmypy doesn't yet support dataclass_transform which is where this would work out of the box, no hackerywide-midnight-78598
12/10/2022, 8:40 PMbitter-ability-32190
12/10/2022, 8:41 PMhundreds-father-404
12/10/2022, 8:57 PMbitter-ability-32190
12/10/2022, 11:22 PMbitter-ability-32190
12/11/2022, 2:29 AMfrozen_after_init in favor of object.__setattr__. ..
I'll float a PR bybitter-ability-32190
12/11/2022, 2:35 AMdataclasses.Field.type being either a string or the type provided (depending on user declaration and the annotations import) is really harshing my mellowbitter-ability-32190
12/11/2022, 2:37 AMmypy plugin...bitter-ability-32190
12/11/2022, 2:47 AMbitter-ability-32190
12/11/2022, 2:50 AMbitter-ability-32190
12/11/2022, 6:31 PM