This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: {a,b} in fnmatch.translate
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, loewis, niemeyer
Priority: normal Keywords: patch

Created on 2002-04-17 12:40 by niemeyer, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-2.3a-fnmatch.patch niemeyer, 2002-04-17 12:40
Messages (5)
msg39621 - (view) Author: Gustavo Niemeyer (niemeyer) * (Python committer) Date: 2002-04-17 12:40
This patch adds support to {a,b} expansion constructs  
in fnmatch.translate. That is, file{a,b}.txt will 
match both, filea.txt and fileb.txt, like usual 
shell expansions. 
  
msg39622 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-04-18 06:01
Logged In: YES 
user_id=21627

I'm concerned about backwards compatibility of this change.
People who currently use { in their patterns get them
translated literally; under your change, this will have a
different effect.
msg39623 - (view) Author: Gustavo Niemeyer (niemeyer) * (Python committer) Date: 2002-04-18 18:07
Logged In: YES 
user_id=7887

Indeed. I was even expecting this answer. It's not usual 
to have such characters in filenames, but they're not 
invalid. OTOH, I discovered that is was not supported 
while trying to use them with globbing meanings, so this 
may be expected by some users. 
 
Anyway, the patch works, and I'd like to use this 
functionality for myself, but if you decide not to 
include it, I'll understand. 
 
msg39624 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-22 18:00
Logged In: YES 
user_id=6380

I'm rejecting this, not for backwards compatibility reasons,
but because the shell semantics are different than those of
the other globbing patterns, and it's better to do this in
your application if you need it. (The difference is that in
the shell, {a,b}.txt expands to a.txt b.txt even if neither
file exists.)

About user expectations: the docs are quite clear about the
patterns recognized by fnmatch, so I don't know what you're
talking about.
msg39625 - (view) Author: Gustavo Niemeyer (niemeyer) * (Python committer) Date: 2002-04-22 20:22
Logged In: YES 
user_id=7887

About "user expectations", as I told before, I was just 
explaining my own experience, and I haven't looked at 
the documentations since I know how shell expansions 
works. But again, I have posted this because I used it in 
a project, and posting it was of no cost to me. My  
opinion is that besides the differences in expanding {}, 
it is useful in many cases. Nevertheless, the rejection 
is ok for me. 
History
Date User Action Args
2022-04-10 16:05:14adminsetgithub: 36451
2002-04-17 12:40:04niemeyercreate