Bash-like brace expansion

Peter Waller peter.waller at gmail.com
Tue Mar 24 13:51:34 CET 2009


2009/3/24 Tino Wildenhain <tino at living-examples.com>
>
>
> 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.


Could this approach be made to handle recursive expansion? From the example
with the script:

pprint(BraceExpand("electron_{n,{pt,eta,phi}[{1,2}]}", ordering = [True]))

Gives:

['electron_n',
 'electron_pt[1]',
 'electron_eta[1]',
 'electron_phi[1]',
 'electron_pt[2]',
 'electron_eta[2]',
 'electron_phi[2]']

Cheers,

- Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090324/9a2332ae/attachment.html>


More information about the Python-list mailing list