Message359764
Actually, couldn't the following be a workaround, just set the property on the class after the class definition:
import dataclasses
import typing
@dataclasses.dataclass
class FileObject:
uploaded_by:typing.Optional[None]=None
def _uploaded_by_getter(self):
return self._uploaded_by
def _uploaded_by_setter(self, uploaded_by):
print('Setter Called with Value ', uploaded_by)
self._uploaded_by = uploaded_by
FileObject.uploaded_by = property(
FileObject._uploaded_by_getter,
FileObject._uploaded_by_setter
)
p = FileObject()
print(p)
print(p.uploaded_by) |
|
Date |
User |
Action |
Args |
2020-01-10 22:24:53 | juanpa.arrivillaga | set | recipients:
+ juanpa.arrivillaga, eric.smith, Michael Robellard |
2020-01-10 22:24:53 | juanpa.arrivillaga | set | messageid: <1578695093.82.0.228581040402.issue39247@roundup.psfhosted.org> |
2020-01-10 22:24:53 | juanpa.arrivillaga | link | issue39247 messages |
2020-01-10 22:24:53 | juanpa.arrivillaga | create | |
|