Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104307

Re: fnmatch() vs. glob.glob()

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: fnmatch() vs. glob.glob()
Date Tue, 08 Mar 2016 12:49:56 +1100
Lines 30
Message-ID <mailman.23.1457401807.15725.python-list@python.org> (permalink)
References <d8ec5d47-3393-41c3-a06c-0ec058763570@googlegroups.com> <mailman.50.1457386649.10335.python-list@python.org> <14061576-1c44-49bb-a27b-279e43258f06@googlegroups.com> <mailman.15.1457398847.15725.python-list@python.org> <7475bb64-b2e7-45ff-a94e-dbc62f658fab@googlegroups.com> <mailman.17.1457399791.15725.python-list@python.org> <a0d8dba4-834b-4e28-95a6-43f8667fe2ce@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de RMm34gRhqhf/x2MKEPzMuAgksvCx+IZnllMci8GfZPyQ==
Cancel-Lock sha1:1RyYxkGWTZSLeu26+h7Q9ti3hLc=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'e.g.,': 0.07; 'verbatim': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; 'type;': 0.09; 'files.': 0.13; 'behaviour.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'regex,': 0.16; 'smart,': 0.16; 'implementing': 0.18; 'switched': 0.18; 'typing': 0.18; 'fit': 0.23; 'feature': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'updating': 0.27; 'wonder': 0.27; 'module.': 0.27; 'behaviour': 0.29; 'certain': 0.31; 'real-time': 0.33; 'could': 0.35; 'level': 0.35; 'according': 0.36; 'but': 0.36; 'depends': 0.36; 'framework': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'say': 0.37; 'received:org': 0.37; 'difference': 0.38; 'itself': 0.38; 'stuff': 0.38; 'anything': 0.38; 'files': 0.38; 'to:addr:python.org': 0.40; 'decision': 0.61; 'here:': 0.63; 'between': 0.65; 'subject:. ': 0.67; 'skip:\xe2 10': 0.70; '8bit%:43': 0.72; 'duty': 0.72; 'feeling': 0.72; 'search,': 0.72; '8bit%:46': 0.76; '_o__)': 0.84; 'gut': 0.84; 'received:125': 0.84; 'faith': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:104307

Show key headers only | View raw


Jinghui Niu <niujinghui@gmail.com> writes:

> Let me try to describe the behaviours as much as I can here: It is a
> real-time search, updating the search result as you type; It is very
> smart, not limiting itself into the verbatim words, but extracting
> feature strings automatically, e.g., typing "fontz" will match not
> just "*fontz*", but also "font-size", "fontzipper", etc; It can be
> switched for certain type of files according specific rules, such as
> not including ".pyc" files.

None of that really depends on the difference between ‘glob’ versus
‘fnmatch’. Either of them could be at the bowels of an implementation of
the behaviour you describe.

> My gut feeling is that it is using Regex, but just wonder how I can
> fit Regex into either fnmatch() or glob() module.

You don't. Those two are *much* lower level than the behaviour you
describe, and don't have anything to say about that behaviour.

You will need all the extra framework implementing all the other stuff
you describe, before you make any decision between ‘fnmatch’ versus
‘glob’.

-- 
 \             “Skepticism is the highest duty and blind faith the one |
  `\               unpardonable sin.” —Thomas Henry Huxley, _Essays on |
_o__)                                   Controversial Questions_, 1889 |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 12:17 -0800
  Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 08:37 +1100
    Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 16:53 -0800
      Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:00 +1100
        Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 17:04 -0800
          Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:16 +1100
            Re: fnmatch() vs. glob.glob() Jinghui Niu <niujinghui@gmail.com> - 2016-03-07 17:37 -0800
              Re: fnmatch() vs. glob.glob() Ben Finney <ben+python@benfinney.id.au> - 2016-03-08 12:49 +1100
              Re: fnmatch() vs. glob.glob() Chris Angelico <rosuav@gmail.com> - 2016-03-08 12:56 +1100
              Re: fnmatch() vs. glob.glob() MRAB <python@mrabarnett.plus.com> - 2016-03-08 02:35 +0000
          Re: fnmatch() vs. glob.glob() Steven D'Aprano <steve@pearwood.info> - 2016-03-08 13:19 +1100

csiph-web