Consider this code:
importtypingclassA:
@propertydeff(self) ->int:
return1@f.setter# Possible error for defining a setter that doesn't accept the type the @property returnsdeff(self, x: str) ->None:
passa=A()
a.f=''# Possibly not an error, but currently mypy gives an errora.f=1# Certainly should be an error, unless we disallowed # defining the setter this way in the first place.reveal_type(a.f) # E: Revealed type is 'builtins.int'
Whatever we decide, I'm happy to build a PR; I have this code loaded into my head.
Consider this code:
Whatever we decide, I'm happy to build a PR; I have this code loaded into my head.