Module var
Variables with a functional interface:
- v() -- return the value of v
- v(x) -- set the value of v to x
For example:
v = v + 1 becomes v(v()+1)
Handy into the lambda expressions
- Classes:
- Var(object): Functional variables
- Attributes:
- _marker = object()
Class var.Var
- Bases:
- object
Functional variables
- Methods:
- __call__(self, v=_marker): Return or set the value
- __init__(self, v=None): Initialisation
- __unicode__(self):
- get(self): Return the value
- render(self, renderer): When directly put into a XML tree, render its value
- set(self, v): Set the value
Method var.Var.__call__
- Arguments:
- self, v=_marker
Return or set the value
- In:
- v -- if given, v becomes the new value
- Return:
- the variable value
Method var.Var.__init__
- Arguments:
- self, v=None
Initialisation
- In:
- v -- initial value
Method var.Var.render
- Arguments:
- self, renderer
When directly put into a XML tree, render its value
- In:
- renderer -- the current renderer
- Return:
- the variable value