Is There a Way to Reference the Output from the Last Step in Python without Using its Name?

This topic was automatically generated from Slack. You can find the original thread here.

Maybe it is too late for me to think straight. In python, is there a way to reference the output from the last step without calling it out by name? I may have mentioned this before, while developing I may change a step name. If I reference exports/results from that step in the next step, I’d thought I’d try a relative reference instead of an absolute.

not today, but we have discussed. Technically the opposite issue would happen if you changed the order of steps above the current step. So if you’re using steps[-1] and then you move the step to a different place, steps[-1]['the_property_you_expect'] may not exist, and that may actually be harder to troubleshoot than the issue with a reference to a bad step name since it would return undefined / None (no error) instead of throwing an error in the current case.

currently we’ll throw e.g. a TypeError or NameError that says steps.foo is undefined and you can’t reference a property of that object, and you can quickly map that to the actual issue since you know you renamed the step. But in the other case, you get no error

true that. I thought of this too. Personally I don’t find myself rearranging as much, this is completely dependent on the user though.

thank you for the quick response

I hear you. I’m not sure either. Probably renaming more than I’m reordering. The DX / lack of error honestly tips me towards not doing it, only because step references are such a core part of the product that we want errors to be incredibly obvious (otherwise new users may get tripped up)