Changes by Constantin Veretennicov kveretenni...@gmail.com:
--
nosy: +kveretennicov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9584
___
___
Ronald Oussoren ronaldousso...@mac.com added the comment:
I agree with Antoine that this would be useful functionality and that matching
the shell is futile here.
A quick check on an old linux server: bash and ksh do brace expansion before
expanding '*', but that csh does both at the same
Fred L. Drake, Jr. fdr...@acm.org added the comment:
It's worth noting that the sh-like shells are far more widely used than the
csh-like shells, so csh-like behavior may surprise more people.
From the sh-like shell perspective, the {...,...} syntax just isn't part of
the globbing handling.
Changes by Terry J. Reedy tjre...@udel.edu:
--
resolution: rejected -
stage: committed/rejected - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9584
___
Mathieu Bridon boche...@fedoraproject.org added the comment:
Wow, I certainly didn't expect to generate so much controversy. :-/
First of all, thanks for the comments on the patch Antoine and David.
I don't get what the purpose of these two lines is. Forbid empty patterns?
I copy-pasted the
Éric Araujo mer...@netwok.org added the comment:
python-idea is read by more people.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9584
___
___
New submission from Mathieu Bridon boche...@fedoraproject.org:
The attached patch allows for shell curly braces with fnmatch.filter().
This makes the following possible:
import fnmatch
import os
for file in os.listdir('.'):
... if fnmatch.fnmatch(file, '*.{txt,csv}'):
... print
Mathieu Bridon boche...@fedoraproject.org added the comment:
The attached patch allows for shell curly braces with fnmatch.filter().
Oops, I meant that it allows for curly braces in fnmatch.translate(), which
makes it available in the whole fnmatch module.
--
R. David Murray rdmur...@bitdance.com added the comment:
Thanks for this suggestion and patch.
In general I think more tests would be good, A test for {} would clarify what
you are expecting there.
--
nosy: +r.david.murray
stage: - patch review
versions: +Python 3.2
Éric Araujo mer...@netwok.org added the comment:
In Bash, * and ? match only characters in existing files, but {a,b} always
produces two filenames, even if the files don’t exist. Do we want to mimic this
behavior in fnmatch?
--
nosy: +eric.araujo
R. David Murray rdmur...@bitdance.com added the comment:
Ah, I had forgotten that detail, Éric.
No, it doesn't seem as if implementing braces as matchers is appropriate.
fnmatch is only implementing the shell file name globbing. Doing the equivalent
of brace expansion would have to be done
R. David Murray rdmur...@bitdance.com added the comment:
My view is that people using fnmatch/glob are expecting to get back the same
list of files that they would if they ran 'echo globpattern' in the shell.
The major shells (sh, bash, zsh, csh) seem to be pretty consistent in this
regard
Antoine Pitrou pit...@free.fr added the comment:
My view is that people using fnmatch/glob are expecting to get back
the same list of files that they would if they ran 'echo
globpattern' in the shell.
But it's not the case since we currently don't process braces anyway.
The major shells
R. David Murray rdmur...@bitdance.com added the comment:
Well, Windows supports * and ? globs, but not brace expansion, as far as I can
tell (at least on XP, which is what I currently have access to).
In fact, I don't believe I've run into brace expansion anywhere except in the
unix shell,
Tim Golden m...@timgolden.me.uk added the comment:
I don't see any reason to turn this down except, perhaps, for keeping something
simple.
Certainly I don't believe that Windows users will be confused by the fact that
there are wildcards other than * and ?. fnmatch already implements [] and
15 matches
Mail list logo