On Thursday 17 November 2016 16:40, Veek M wrote:

> In C:
> int x = 10;
> results in storage being allocated and type and location are fixed for
> the life of the program.
> 
> In Python,
> x = 10
> 
> causes an object '10' to be created but how exactly is 'x' handled?
> Symbol Table lookup at compile time? 

No. Symbol table lookup at run time.

For functions, you can access a copy of the symbol table with:

locals()

You can access the actual global symbol table (not a copy) with:

globals()


Every module has its own independent global symbol table.



-- 
Steven
299792.458 km/s — not just a good idea, it’s the law!

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to