[Patches] [ python-Patches-545150 ] {a,b} in fnmatch.translate

noreply@sourceforge.net noreply@sourceforge.net
Mon, 22 Apr 2002 11:00:32 -0700


Patches item #545150, was opened at 2002-04-17 08:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=545150&group_id=5470

Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Gustavo Niemeyer (niemeyer)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: {a,b} in fnmatch.translate

Initial Comment:
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. 
  

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-04-22 14:00

Message:
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.

----------------------------------------------------------------------

Comment By: Gustavo Niemeyer (niemeyer)
Date: 2002-04-18 14:07

Message:
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. 
 

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-04-18 02:01

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=545150&group_id=5470