Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: fnmatch() vs. glob.glob() Date: Tue, 08 Mar 2016 12:49:56 +1100 Lines: 30 Message-ID: References: <14061576-1c44-49bb-a27b-279e43258f06@googlegroups.com> <7475bb64-b2e7-45ff-a94e-dbc62f658fab@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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104307 Jinghui Niu 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