Heh, thanks :) Unit tests did cross my mind. I was kicking myself for not starting out with them, there were several regressions during development, and there could well still be lurking corner cases ;)
I've since heard that a 'better way' would be to use pyparsing. Also, I saw that python has dropped the idea of having recursive regular expressions at the moment. http://bugs.python.org/msg83993 Maybe I might re-implement this with pyparsing and some unit tests. On Mar 24, 2:30 pm, Nick Craig-Wood <n...@craig-wood.com> wrote: > Peter Waller <peter.wal...@gmail.com> wrote: > > Okay, I got fed up with there not being any (obvious) good examples of > > how to do bash-like brace expansion in Python, so I wrote it myself. > > Here it is for all to enjoy! > > Interesting! > > Might I suggest some unit tests? You can then test all the corner > cases (unmatched brackets, empty brackets, etc) and be sure it works > exactly as specified. doctest is cool for this kind of stuff. > > -- > Nick Craig-Wood <n...@craig-wood.com> --http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list