[Python-Dev] cpython: issue9584: Add {} list expansion to glob. Original patch by Mathieu Bridon
Tim Golden
mail at timgolden.me.uk
Thu Nov 8 21:52:25 CET 2012
On 08/11/2012 20:43, Georg Brandl wrote:
> On 11/06/2012 02:56 PM, tim.golden wrote:
>> http://hg.python.org/cpython/rev/dafca4714298
>> changeset: 80273:dafca4714298
>> user: Tim Golden <mail at timgolden.me.uk>
>> date: Tue Nov 06 13:50:42 2012 +0000
>> summary:
>> issue9584: Add {} list expansion to glob. Original patch by Mathieu Bridon
>>
>> files:
>> Doc/library/glob.rst | 11 ++--
>> Lib/glob.py | 65 ++++++++++++++++++++++--------
>> Lib/test/test_glob.py | 64 +++++++++++++++++++++++++++++-
>> Misc/NEWS | 3 +
>> 4 files changed, 118 insertions(+), 25 deletions(-)
>>
>>
>> diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst
>> --- a/Doc/library/glob.rst
>> +++ b/Doc/library/glob.rst
>> @@ -13,10 +13,10 @@
>>
>> The :mod:`glob` module finds all the pathnames matching a specified pattern
>> according to the rules used by the Unix shell. No tilde expansion is done, but
>> -``*``, ``?``, and character ranges expressed with ``[]`` will be correctly
>> -matched. This is done by using the :func:`os.listdir` and
>> -:func:`fnmatch.fnmatch` functions in concert, and not by actually invoking a
>> -subshell. (For tilde and shell variable expansion, use
>> +``*``, ``?``, character ranges expressed with ``[]`` and list of options
>> +expressed with ``{}`` will be correctly matched. This is done by using the
>> +:func:`os.listdir` and :func:`fnmatch.fnmatch` functions in concert, and not by
>> +actually invoking a subshell. (For tilde and shell variable expansion, use
>> :func:`os.path.expanduser` and :func:`os.path.expandvars`.)
>
> Needs a versionchanged.
>
> In any case, brace expansion is not part of globbing (see the bash or zsh
> manuals) because it does not generate valid file names, and it is a non-POSIX
> expansion of some shells. Are you sure it should be put into the glob module?
> (Not speaking of the backward incompatibility it creates.)
I backed it out very soon afterwards, Georg. It had had some (quite a
bit of) discussion on the issue, but I'd messed up the patch somehow and
the backwards compat issue was raised pretty much immediately by Serhiy.
So I pulled the commit.
TJG
Insofar as
More information about the Python-Dev
mailing list