-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make luigi.task.externalize return shallow copies #1952
Make luigi.task.externalize return shallow copies #1952
Conversation
@Tarrasch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @steenzout, @gpoulin and @erikbern to be potential reviewers. |
Actually, I think this needs to return a copy of the original class and or object. |
3213d40
to
2aefc92
Compare
I will also try the |
The last test I added currently fails. But I believe it will stop failing once we merge #1953, once that is merged I'll rebase this. |
Currently, running externalize on an existing class or object will have serious side effects. Like subsequently created objects from the original passed in class will also be externalized. I see two reasons we should allow for this (possibly) overly dynamic behavior in both accepting classes and objects. First, novice users don't pay attention to the difference, second, it still possible and it will *seem* to work to pass in the class instead of the object. I was at least tempted to without being sure if it was "correct". Instead let's try to be soft on the users for this case. Also document that luigi.task.externalize is flexible in the sense it both accepts a class and an object.
f8738f0
to
07bf8d1
Compare
yeah i think this makes a lot of sense |
Currently, running externalize on an existing class or object will have serious side effects. Like subsequently created objects from the original passed in class will also be externalized. This patch changes the behavior to return a changed copy and not having as much side-effects. Secondly, this patch officially declares this function to work on both classes and objects. I see two reasons we should allow for this (possibly) overly dynamic behavior in both accepting classes and objects. First, novice users don't pay attention to the difference, second, it still possible and it will seem to work to pass in the class instead of the object. I was at least tempted to without being sure if it was "correct". Instead let's try to be soft on the users for this case.
Currently, running externalize on an existing class or object will have serious side effects. Like subsequently created objects from the original passed in class will also be externalized. This patch changes the behavior to return a changed copy and not having as much side-effects. Secondly, this patch officially declares this function to work on both classes and objects. I see two reasons we should allow for this (possibly) overly dynamic behavior in both accepting classes and objects. First, novice users don't pay attention to the difference, second, it still possible and it will seem to work to pass in the class instead of the object. I was at least tempted to without being sure if it was "correct". Instead let's try to be soft on the users for this case.
Description
Currently, running externalize on an existing class or object will have
serious side effects. Like subsequently created objects from the
original passed in class will also be externalized. This patch changes
the behavior to return a changed copy and not having as much side-effects.
Secondly, this patch officially declares this function to work on both
classes and objects.
I see two reasons we should allow for this (possibly) overly dynamic
behavior in both accepting classes and objects. First, novice users
don't pay attention to the difference, second, it still possible and it
will seem to work to pass in the class instead of the object. I was at
least tempted to without being sure if it was "correct". Instead let's
try to be soft on the users for this case.
Have you tested this? If so, how?
I added many test cases and I've tested this in a little bit of production code.