Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'bash': 0.07; 'expressions': 0.07; 'processing.': 0.07; 'scripts': 0.09; 'scripting': 0.09; 'python': 0.11; 'language,': 0.11; 'syntax': 0.13; '"python': 0.16; '10:13': 0.16; 'bash,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'pipes': 0.16; 'script?': 0.16; 'wrote:': 0.16; 'hack': 0.18; 'shell': 0.18; 'pipe': 0.22; 'am,': 0.23; 'seems': 0.24; 'header :In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'external': 0.27; 'this.': 0.28; 'actual': 0.29; 'fine': 0.29; 'perl': 0.29; 'way?': 0.29; "skip:' 10": 0.30; 'certainly': 0.31; "can't": 0.32; 'utility': 0.33; 'file': 0.34; 'message-id:@gmail.com': 0.35; 'to:addr:python-list': 0.35; 'integrate': 0.35; 'programming.': 0.35; 'replace': 0.35; 'really': 0.35; "isn't": 0.35; 'but': 0.36; 'text': 0.36; 'tool': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'instead': 0.38; 'received:org': 0.38; 'building': 0.38; 'say': 0.38; 'doing': 0.38; 'things': 0.39; 'to:addr:python.org': 0.39; 'easily': 0.39; 'received:192': 0.39; 'why': 0.40; 'your': 0.60; 'more': 0.62; 'charset:windows-1252': 0.65; 'results': 0.66; 'suited': 0.72; 'heavy': 0.81; 'cecil': 0.84; 'find.': 0.84; 'westerhof': 0.84; 'besides,': 0.93; 'poorly': 0.93 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 04 Jun 2015 13:09:06 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Find in ipython3 References: <87y4k2hyvf.fsf@Equus.decebal.nl> In-Reply-To: <87y4k2hyvf.fsf@Equus.decebal.nl> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433444951 news.xs4all.nl 2864 [2001:888:2000:d::a6]:34421 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92086 On 06/02/2015 10:13 AM, Cecil Westerhof wrote: > I am thinking about using ipython3 instead of bash. When I want to > find a file I can do the following: > !find ~ -iname '*python*.pdf' > but is there a python way? No more than there is a bash-native way of doing find. Bash scripts use a myriad of external, utility programs like find, cut, awk, sed, etc to do heavy lifting. The same things work just fine in iPython. Why do you need a "python way?" Besides, Python isn't really a shell scripting language, and ipython seems more like a hack to me. Bash, Zsh, etc are all better suited to actual shell scripting because their syntaxs integrate the spawning external processes and building pipes in a nice way (if you can call bash syntax nice). That's not to say Python can't be used for system programming. It certainly can. And it can replace perl easily at fast text processing. Generator expressions are the single most powerful tool in this. Why not use Python for what it's good for and say pipe the results of find into your python script? Reinventing find poorly isn't going to buy you anything.