khanna-lab / cadre

Other
0 stars 0 forks source link

Two questions on splitting an instance method on a class into multiple methods #28

Closed khanna7 closed 2 years ago

khanna7 commented 2 years ago

https://github.com/khanna7/cadre/blob/9d1f5d42ec1581b7009bd7f72e8f71a2249cd089/python/pycadre/cadre_person.py#L85

I had wanted to put the release process (starting in the referenced line) in a separate class method, say simulate_release, to make it easier to test separately. But if I set up a new class here, I didn’t know how to access the updated value of the self.current_incarceration_status from the previous simulate_incarceration class, so it could be used to update attributes relevant to the release process.

Two questions:

khanna7 commented 2 years ago

Daniel says using Repast would be a good thing here, because it can schedule events directly.

khanna7 commented 2 years ago

But we were able to do this, by just splitting separating out simulate_release from the simulate_incarceration