'setting data frame name automatically (not hardcoding)

I have a function used by at least 1000 dataframes and I want to know each time this function is called, which df has passed to this function,

def multi_purp_df(df):
    print(f'Name of df passed is: {df.name}')
    return 

I know one way is to set df.name = df_client before calling the function but this means setting the name 1000 times in different places! Is there any way to do this inside the function automatically? For example, with multi_purp_df(df_client), I like to print df_client



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source