[Zope] Grabbing specific indexes from an #in

Michel Pelletier michel@digicool.com
Mon, 19 Jul 1999 16:35:33 -0400


> -----Original Message-----
> From: craigv@jps.net [mailto:craigv@jps.net]
> Sent: Monday, July 19, 1999 3:23 PM
> To: zope@zope.org
> Subject: [Zope] Grabbing specific indexes from an #in
> 
> 
> I am trying to find a way to grab a specific index from an 
> #in. I would
> like to use this much like an array in which I could ask for 
> the object
> at index [i]. Is there a way to grab specific indexes from an #in
> without iterating through the entire list of objects?
> 

No need to use #in if you just want one item:

<!--#var "sequence[index]"-->

you can slice too:

<!--#in "sequence[5:]"-->
...
<!--#/in-->

gives you the fifth to the last element.  Note the quotes.  This is an
evaluation of an expression.

-Michel

-Michel

> Thanks, 
> 
> --Craig
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>