Skip to content
Advertisement

Is input arguments to a function returned always by default?

I have a function like given below. The code works fine and I require your assistance only in helping me to understand how the return or function output is stored. I am a beginner and your inputs would be helpful

JavaScript

As you can see, I am only returning the result dataframe as output from the function. No other variables are returned from function

When I call the function in sequence like below, I expect it throw an error at the last line for dataFramesDict[sheet_name] but it works fine.

JavaScript

Shouldn’t I be getting an error message like below

sheet_name isn’t defined

I tried restarting the kernel to make sure that it’s not defined elsewhere.

Because sheet_name isn’t a global variable. It is only passed as an argument to the above function. Does function always return input arguments by default as well?

Advertisement

Answer

Variable sheet_name is defined outside transform_stage_2_df as you are using it as an input parameter and thus is already defined outside.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement