variable scopes in python:
For a variable, python interpreter will access/search it starting from Local scope.
If it is not found in local scope, it will check in Enclosing defs as per following order.
L (local)
-> E (enclosing def or lamba)
-> G (global)
-> B (built in)
For a variable, python interpreter will access/search it starting from Local scope.
If it is not found in local scope, it will check in Enclosing defs as per following order.
L (local)
-> E (enclosing def or lamba)
-> G (global)
-> B (built in)
No comments:
Post a Comment