Bash-like brace expansion
Tino Wildenhain
tino at living-examples.com
Tue Mar 24 08:48:44 EDT 2009
Peter Waller 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!
>
> If anyone has any better solutions or any other examples of how to do
> this, I'd be glad to hear from them.
>
It may be a funny experiment but I really fail to see the value in your
proposal.
The simple {foo} expansion you mention should be quite easily handled
with re.sub and a function as argument. So not much more then a few
lines of code.
Interesting could be to have {foo#bar} and {foo%bar} as well but again
I don't think the whole stuff would be very usefull anyway given the
%(foo)s form works quite well and has a host of options (for aligning
for example).
Cheers
Tino
More information about the Python-list
mailing list