Bash-like brace expansion

Peter Waller peter.waller at gmail.com
Tue Mar 24 13:39:50 EDT 2009


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... at craig-wood.com> wrote:
> Peter Waller <peter.wal... at 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... at craig-wood.com> --http://www.craig-wood.com/nick




More information about the Python-list mailing list