Juan Arrivillaga <[email protected]> added the comment:
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)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com