GitHub user gidhubuser255 added a comment to the discussion: APIs for updating 
underlying function of a node (2 part question)

> we could modify override that it does 2 more things

What does "override" refer to here? Is that a decorator or method?

One other way I could see this working which is more consistent with 
`@config.when` for node replacement, would be something like 
`@path.passes_through`, which could work something like this:

```
def X() -> int:
    return 9

@path.passes_through('B', name='X')
def X_prime() -> int:
    return 99
```

With regards to your pseudo-code example of how to make that work currently, 
that does indeed work, however gets a bit unwieldy for anything beyond a simple 
example. If you have multiple nodes between your converging point and the node 
you want to replace, you'll have to enumerate them all as steps in your 
pipe_inputs, like so:

```
from hamilton import driver
from hamilton.function_modifiers import pipe_input, step

def A(B: int, C: int) -> int:
    return B + C

@pipe_input(
    step(Y),
    step(Z),
    step(D),
)
def B(X: int) -> int:
    return X + 1

@pipe_input(
    step(Y),
    step(Z),
    step(D),
)
def C(X: int) -> int:
    return X + 2

def D(Z: int) -> int:
    return Z + 1

def Z(Y: int) -> int:
    return Y * 2

def Y(X: int) -> int:
    return X * 3

def X() -> int:
    return 9

dr = (
    driver.Builder()
    .with_modules(__import__('__main__'))
    .build()
)

print(dr.execute('A'))
```

And if there's more bifurcating/converging points in between that gets 
significantly harder to represent.

> how this will play with caching

Unfortunately I'm not familar with how the caching scheme works in depth. 
However, my hunch would be that since this would still allow a static built 
graph (just with an extra post processing step that would analyze the paths and 
unravel them if necessary) it could potentially be compatible with the existing 
caching scheme.


GitHub link: 
https://github.com/apache/hamilton/discussions/1397#discussioncomment-14587007

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]

Reply via email to