Skip to content

Conversation

@jasonkarns
Copy link

@jasonkarns jasonkarns commented Mar 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant