[Zope] What is lst[0] ??

Nicolas Évrard nicoe@wanadoo.be
Tue, 13 Aug 2002 02:29:25 +0200


--yrj/dFKFPuw6o+aM
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,=20

Since I wanted to have only the 5 last entries of a folder containing
news, i did this little script and used it in a ZPT :

sorted_lst =3D sequence.sort(lst, (('date', 'cmp', 'desc'),
                                 ('titre', 'nocase', 'asc')))

if len(sorted_lst) <=3D 5 : return sorted_lst
else : return sorted_lst[0:5]

It works well, I've got what I want ...

But I wonder why should I use sorted_lst[0:5] to have 5 elements since
there is in fact 6 elements in it ?? I suppose sorted_lst[0] is some
kind of a dummy element to stock some informations ... Am I right ?

--=20
(=B0>  Nicolas =C9vrard
/ )  Li=E8ge - Belgique
^^

--yrj/dFKFPuw6o+aM
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9WFLl1fJ5cz1/+2URAjt4AJ4lGcxGKFix8F+qGSXw2W3lKzIYNgCfZ6wh
KEzbcpzljiHOATPrjdhFpmU=
=yFvL
-----END PGP SIGNATURE-----

--yrj/dFKFPuw6o+aM--