Is it considered ok if a getter also update itself when it’s evaluated, below code works but I am not sure if this is considered acceptable.
`@property
def current_time(self):
self._current_time = datetime.now(timezone.utc).astimezone(ZoneInfo('localtime'))
return self._current_time`
This allows me to get the new time every time I evaluate obj.currren_time, since I am not setting anything externally I don’t need a setter.
New contributor
Broken Arrow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.