list index()

Francesco Guerrieri f.guerrieri at gmail.com
Sun Sep 2 11:29:28 EDT 2007


On 9/2/07, Zentrader <zentraders at gmail.com> wrote:
>
> On Aug 30, 11:23 am, zzbba... at aol.com wrote:
> > Neil, Steve,
> >
> > Thanks for the responses on sets. I have not used them before and was
> > not even aware Python had them. I will try them out.
>
> And if there weren't sets you would still not use find or index but a
> brute force method or dictionaries
> for each in dir_a_list :
>    if each not in dir_b_list :
>       print each, "not in dir_b"
>


This is O(N_a * N_b)... unless the list are always small, it's definitely
better (if one is decided not to use sets) to use dictionaries :-)


bye
francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070902/e6d4cd1b/attachment.html>


More information about the Python-list mailing list