Pattern Matching Over Python Lists

eliben eliben at gmail.com
Mon Jun 23 00:28:26 EDT 2008


> Fair enough. To help you understand the method I used, I'll give you
> this hint. It's true that regex on works on strings. However, is there
> any way to convert arbitrarily complex data structures to string
> representations? You don't need to be an experienced Python user to
> answer to this ;)

As Paddy noted before, your solution has a problem, Regexes can't
match nested parenthesis, so I think your method will have a problem
with nested lists, unless your actual inputs are much simpler than the
general case.

Eli



More information about the Python-list mailing list