
Hi, A few days ago I submitted a feature request for the fnmatch module to allow curly braces shell-like expansions: http://bugs.python.org/issue9584 The patch I submitted was found to be incorrect, and I'm working on it (I already have a patch that seems to be working and I need to test it extensively). However, some concerns were raised about the fnmatch module not being the correct place to do that, if the goal is to mimic shell behavior. Expansion would have to be done before, generating the list of patterns that would then be given to fnmatch. It was suggested that I took this issue on Python-ideas, so here we go. What do people think? Should it be done in fnmatch, expanding the curly braces to the regex? Should it be done before that? If the latter, what would be an appropriate module to expand the braces? glob? Another module? FWIW (i.e not much), my opinion is leaning towards implementing it in glob.py: - add '{' to the magic_check regex - in glob1 (which is called when the pattern 'has_magic'), expand the braces and then call fnmatch.filter() on each resulting pattern That would respect more what is done in shells like Bash, and it makes it also more straight-forward to implement. Cheers, -- Mathieu