Skip to content Skip to sidebar Skip to footer
Showing posts with the label Scope

Jinja Template Variable Assignment Scope

Given the following Jinja snippet {% set sep='' %} {% for … Read more Jinja Template Variable Assignment Scope

Why Doesn't A Sub-function Inherit Scope In Python?

I don't understand why the following doesn't work: def foo( x ): n = 1 summe = 0 … Read more Why Doesn't A Sub-function Inherit Scope In Python?

Access Objects From Another Module

I'm a very inexperienced programmer creating a game (using Python 3.3) as a learning exercise. … Read more Access Objects From Another Module

Error Despite Global Keyword Being Used To Access Variable Inside Function

I have created few global variables as shown in my code below. However when I try to use them insid… Read more Error Despite Global Keyword Being Used To Access Variable Inside Function

Generator Expression Evaluation With Several ... For ... In ... Parts

Question: What does Python do under the hood when it sees this kind of expression? sum(sum(i) for… Read more Generator Expression Evaluation With Several ... For ... In ... Parts

Python Variable Scope (passing By Reference Or Copy?)

Why does the variable L gets manipulated in the sorting(L) function call? In other languages, a co… Read more Python Variable Scope (passing By Reference Or Copy?)