[Zope] Radio button effect for links - thanks!

seb bacon seb@jamkit.com
Wed, 18 Jul 2001 16:01:18 +0100


* rlanham@speakeasy.net <rlanham@speakeasy.net> [010718 14:58]:
> But I stand corrected in advance for probably being wrong or too narrow in this explanation.
> > Worked a treat, thanks.
> > 
> > Could someone explain what _[ ] means?

> ... I know that _ is the namespace, everything that is to be had is
> inside there, including form, querystring and envirnment vars. 
> 
> And using [] is a way (I think) of saying return the text of the id
> rather than the object it represents.

Almost :-)

You're right about _.  But the [] is the standard python syntax for
accessing dictionary elements.  If you have a dictionary which looks
like this:

 foo = {'name':'zebra','age':34}

then foo['name'] will return 'zebra'.

In the same way, _['myvariable'] will return the value of your
variable.  If myothervariable is set to 'bar', then _[myothervariable]
is equivalent to _['bar'].

seb