Path: csiph.com!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 08:37:17 +1100 Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Qvzvv2tJrVM4CNJ8LWJ8Xw3PNvS5xQN/4lyQFjpLceCg== Cancel-Lock: sha1:Pfd3XYeSXzsN/1VEunMzIyxpdfU= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'filenames': 0.07; 'modules.': 0.09; 'patterns,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; 'python': 0.10; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'bit': 0.23; 'matching': 0.23; 'unlike': 0.23; 'unix': 0.24; 'module': 0.25; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'adams': 0.29; 'cases.': 0.29; 'closer': 0.29; 'character': 0.29; "i'm": 0.30; 'possibly': 0.32; 'url:python': 0.33; 'url:org': 0.36; 'beginning': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'seem': 0.37; 'starting': 0.37; 'stuff': 0.38; 'hi,': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'goal': 0.64; 'between': 0.65; 'goals': 0.67; 'subject:. ': 0.67; 'skip:\xe2 10': 0.70; '8bit%:40': 0.72; 'special': 0.73; '_o__)': 0.84; 'received:125': 0.84; 'studying': 0.84; 'treats': 0.84; '\xe2\x80\x9cwe': 0.84 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:104256 Jinghui Niu writes: > Hi, I've been studying python 3 modules. I'm a bit confused about the > possibly overlap between fnmatch() and glob(), they seem to achieve > the same goals exactly. Why duplicate? >From the module documentation: Note that unlike fnmatch.fnmatch(), glob treats filenames beginning with a dot (.) as special cases. So the goals are different: ‘glob.glob’ has the goal of matching closer to the Unix meaning of glob patterns, where filenames starting with a “.” character are conventionally treated as “hidden by default”. -- \ “We are stuck with technology when what we really want is just | `\ stuff that works.” —Douglas Adams | _o__) | Ben Finney