"Italo Maia" <[EMAIL PROTECTED]> writes:

> [-1]? Where do i put this? Something like:
> "noticias=Noticia.select(orderBy=Noticia.q.data)[-1]" ???
> If it is, it's not working >__>. Heheh, i know i can use reverse, but
> how it goes with this '-1'?

Sorry, it should be "[::-1]".

It's the idiom for reversing a list in Python (if you don't have the reverse
property):

>>> list = ['a', 'b', 'c']
>>> list
['a', 'b', 'c']
>>> list[::-1]
['c', 'b', 'a']
>>> list
['a', 'b', 'c']
>>> list.reverse()
>>> list
['c', 'b', 'a']


So, list.reverse() reads all data and returns then in reversed order, changing
the object while [::-1] doesn't change it but returns data in reversed order
as well.  Which one is more efficient to you depends on how many records you
have and what you're doing :-)


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to