Support dict in set tags#289
Conversation
fkiraly
left a comment
There was a problem hiding this comment.
Hm, I second the idea, but this will break working code, will it not? Where previously people have used explicit kwargs, it will now lead to an exception unless the first kwarg is a dict.
Can we do something that is completely deprecation safe?
|
Why will it break the code? I explicitly test that passing just kwargs will continue to work. |
|
It would break the code How about we use |
|
so, for all |
yarnabrina
left a comment
There was a problem hiding this comment.
I'm not able to follow you. Can you please explain which of these steps is the issue?
4d84354 to
861a5d9
Compare
|
I ran all tests locally (fixed a typo in test) and all pass. |
|
The issue is, this is in-principle an interface breaking change. Adding a keyword arg at the start always is. In this case, the change is equivalent to doing if "tags_to_set" in kwargs:
kwargs.update(kwargs.pop("tags_to_set"))My comment: if you want to do for args in args:
kwargs.update(arg) |
I'm very sorry, but this is the part that I still don't understand. May be (must, not may) I'm missing something obvious, but can you please explain?
This is also something I don't understand. If you mean use *args, pass a dict, and loop over |
An interface breaking change is a change where previously working code breaks after the change. Examples of hanges that are always interface breaking:
It suffices to show an example of breaking code to prove that a change is interface breaking - or check whether it is a subcase of above examples (if you believe these are interface breaking). An example for this change is
Just loop over all Like this: for args in args:
kwargs.update(arg)Why is this bad, can you explain? |
1. just kwargs (old case) 2. just dict (new case) 3. both dict and kwargs (mixed case)
Is your concern only for the EXTREMELY specific case of tag name being "tags_to_set" that matches the newly introduced dictionary argument? If that's the case, this is probably too rare. When you add new tags in For now, I've tried to handle with if-else. Please take a look. It's still breaking if you consider even more specific case of
When I said that, my impression was you are expecting users to pass only one dictionary as part of
Currently we have to use If I understand your suggestion, you are expecting developers to pass |
861a5d9 to
d4373d7
Compare
Not at all! This is just an option, your desired
I think the code is much simpler stlil? for arg in args:
assert isinstance(arg, dict), "Oh no!"
kwargs.update(arg) |
|
(no particularly strong opinions though, just making sure we |
From #289, the update to the contributors file was valid due to earlier contributions.
Closes sktime/sktime#5960