This paste expires on 2023-06-20 06:42:45.252948. Repaste, or download this paste. . Pasted through web.

from typing import Any
from dataclasses import dataclass, field
@dataclass
class D:
    # why no mypy warning on incompatible type assignment?
    # i want to achieve something similiar like this for my custom `dataclass`-like class.`
    t: int = field(default=0)
    
class MyField:
    def __init__(self, **kwargs: Any) -> None:
        pass
class F:
    # error: Incompatible types in assignment (expression has type "MyField", variable has type "int")  [assignment]
    t: int = MyField(default=0)
Filename: None. Size: 529b. View raw, , hex, or download this file.