Counting elements in a list wildcard

Edward Elliott nobody at 127.0.0.1
Tue Apr 25 13:04:29 EDT 2006


John Machin wrote:
> On 25/04/2006 6:26 PM, Iain King wrote:
>> iain = re.compile("(Ia(i)?n|Eoin)")
>> steven = re.compile("Ste(v|ph|f)(e|a)n")
> 
> IMHO, the amount of hand-crafting that goes into a *general-purpose*
> phonetic matching algorithm is already bordering on overkill. Your
> method using REs would not appear to scale well at all.

Also compare the readability of regular expressions in this case to a simple
list:
["Steven", "Stephen", "Stefan", "Stephan", ...]



More information about the Python-list mailing list