On Nov 24, 6:55 am, Gilles Ganault <[EMAIL PROTECTED]> wrote: > On Sun, 23 Nov 2008 17:55:48 +0000, Arnaud Delobelle > > <[EMAIL PROTECTED]> wrote: > >But there is no reason why you should use a dictionary; just use a list > >of key-value pairs: > > >patterns = [ > > ("pattern1", re.compile(">.+?</td>.+?>(.+?)</td>"), > > Thanks for the tip, but... I thought that lists could only use integer > indexes, while text indexes had to use dictionaries. In which case do > we need dictionaries, then?
You don't have a requirement for indexing -- neither a text index nor an integer index. Your requirement is met by a sequence of (name, regex) pairs. Yes, a list is a sequence, and a list has integer indexes, but this is irrelevant. General tip: Don't us a data structure that is more complicated than what you need. -- http://mail.python.org/mailman/listinfo/python-list