Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Followup to #1 (and graphiti-api#91)
This alternative PR also extends the module in the task body. I'm curious of your use cases and opinions on if that's a good idea or not.
The downside is that
self
within the task (and thus the object being extended by the module), is still the main object. So in the strictest sense, this is still polluting the global namespace. However, the module is only extended when that particular task is run, so it does not affect the global namespace when other tasks are run. Personally I find that a reasonable tradeoff in general (and for that reason, I typically suggest (to my teams) the pattern of using local modules in their own files, and required+included/extended in the task body.But since this is for a library, and the module-function invocation of these helpers is sufficient, I could see erring on the side of caution instead and opting to stick with #1 instead of this.