You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For those generators that may need to close down connections, dump/complete models, stop background processes, or perform some other computation upon being informed that no more points will be requested.
The text was updated successfully, but these errors were encountered:
Clarifying that we don't advocate for this to only accommodate APOSMM. For "objects that produce data" this is a common but by-no-means required pattern.
Consider that file-handles, database connections, or other objects into which data are read and written commonly have .close() or some equivalent. In Python this is commonly accomplished through context switching with with. This could be possible with generators too.
This .close(), .finalize(), __enter__()/__exit__() or however such a method would be implemented, I don't think this falls under "orchestration" anymore than closing a file orchestrates the data from that file.
I personally am starting to lean towards optional context-switching. Its elegant, pythonic, self-explanatory, and document-able.
This proposes a new standard method:
finalize()
For those generators that may need to close down connections, dump/complete models, stop background processes, or perform some other computation upon being informed that no more points will be requested.
The text was updated successfully, but these errors were encountered: