Check sibling questions

What do you mean by globals() and locals () functions.

 

Answer:

The globals( ) and locals( ) functions can be used to return the names in the global and local namespaces depending on the location from where they are called.

If the locals( ) function is called from within a function, it will return the names of all the variables that can be accessed locally from that function.

If the globals( ) function is called from within a function , it will return the names of all the variables that can be accessed globally from that function.  

Are ads bothering you?

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.