Hey folks, qq on config.when when matches against ...
# hamilton-help
k
Hey folks, qq on config.when when matches against multiple config values. So if I have something like
Copy code
@config.when(stage="training", imputation="median")  # type: ignore[misc]
def imputers__training__median(
What do I actually do about those dunders? It seems to be properly included into graph like this, but do we really need to enumerate all those values in the function name? Thanks!
t
Hi Konstantin! When you use
@config.when
to define two
imputers
nodes, you need to have functions named
imputers__SOMETHING()
and
imputers_SOMETHING_ELSE()
. What you put after the dunder is up to you (Hamilton doesn't read it). You could have
imputers__default()
,
imputers__v1()
,
imputers__training()
and organize it how you prefer
k
Alright, so basically anything after the dunder is for my own understanding and there is no expectation from the frameworks side what it is in there? I know I’m rehashing what you said, but just want to make sure I understand it right.
👍 1
Thanks @Thierry Jean
t
exactly!
🙌 2
k
This is quite a relief thanks!
e
Thanks @Thierry Jean! To add/confi — they should only have one set of dunders in them. Under the hood it’ll find the last
__
and remove that + everything after that, but I think it’s fair to assuem that multiple sets of
__
is closer to undefined behavior
👍 2