This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author juanpa.arrivillaga
Recipients Michael Robellard, eric.smith, juanpa.arrivillaga
Date 2020-01-10.22:24:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578695093.82.0.228581040402.issue39247@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2020-01-10 22:24:53juanpa.arrivillagasetrecipients: + juanpa.arrivillaga, eric.smith, Michael Robellard
2020-01-10 22:24:53juanpa.arrivillagasetmessageid: <1578695093.82.0.228581040402.issue39247@roundup.psfhosted.org>
2020-01-10 22:24:53juanpa.arrivillagalinkissue39247 messages
2020-01-10 22:24:53juanpa.arrivillagacreate