[ python ] globals()

globals()

It can be very useful in a debugging session to see what objects the global scope actually contains.

Example

globals()['mail']

locals()

to see the variables defined in a function

dir

to see the contents of a module, or the attributes of an object

 

ref : https://stackoverflow.com/questions/12693606/reason-for-globals-in-python

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s