[Zope] Re: RE: [Zope] Grabbing specific indexes from an #in
Michel Pelletier
michel@digicool.com
Thu, 22 Jul 1999 14:44:27 -0400
> -----Original Message-----
> From: craigv@jps.net [mailto:craigv@jps.net]
> Sent: Thursday, July 22, 1999 2:32 PM
> To: zope@zope.org
> Subject: [Zope] Re: RE: [Zope] Grabbing specific indexes from an #in
>
>
> Hope I don't seem dense, but could I get a bit more clarification?
>
> Right now I am iterating through like this:
> <!--#in "objectValues('Folder')" sort=sort_code-->
>
> ... and pulling out certain properties of each folder:
> <!--#var "_['some_property']"-->
>
> How do I achieve the same goal while picking the folder at a specific
> sequence? For example, I want to display some properties of
> the folders
> at indexes 2, 5, and 7 without iterating through all of the folders.
>
> Thanks in advance for your help.
>
<!--#with "_(list = objectValues['Folder'])"-->
<!--#in "[list[2], list[5], list[7]]"-->
<!--#var some_property-->
<!--#/in-->
<!--#/with-->
-Michel
> --Craig
>
> > > 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 )
> >
>
> _______________________________________________
> 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 )
_______________________________________________
Zope maillist - Zope@zope.org
http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see:
http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org -
http://www.zope.org/mailman/listinfo/zope-dev )