"一首诗" <[EMAIL PROTECTED]> writes:

> I saw a lot of "value_for" in the templates of widgets.

It will get the value of the specified variable from the dictionary.  It's
kind like a get for dicts:

>>> a = dict(b = 1, c = 3, e = 5)
>>> a
{'c': 3, 'b': 1, 'e': 5}
>>> a.get('d')
>>> a['d']
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
KeyError: 'd'
>>> 

If the value doesn't exist it returns None or what you specify:

>>> a.get('d', 0)
0
>>> 

-- 
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to