Skip to content

Commit

Permalink
add comment requested by Jason Madden
Browse files Browse the repository at this point in the history
  • Loading branch information
d-maurer committed Mar 27, 2020
1 parent 1130a23 commit 874b0db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/zope/tales/tales.py
Expand Up @@ -744,6 +744,15 @@ def setGlobal(self, name, value):
vars[name] = value

def getValue(self, name, default=None):
"""return the current value of variable *name* or *default*."""
# ``beginScope`` puts a copy of all variables into ``vars``
# and pushes it onto ``_vars_stack``,
# ``endScope`` pops the last element of ``vars_stack`` into ``vars``,
# ``setGlobal`` updates all variable bindings in ``_vars_stack``
# (and thereby, implicitly, ``vars``).
# Consequently, the current value of a variable can
# always be found in ``vars``
# (no need to iterate over ``_vars_stack``).
return self.vars.get(name, default)

def setRepeat(self, name, expr):
Expand Down

0 comments on commit 874b0db

Please sign in to comment.