Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: I'm wrong or Will we fix the ducks limp? Date: Fri, 3 Jun 2016 22:12:37 -0400 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de QXDpwXd+K6tEIr+dyYyxTghBTQN27Vg1wkHFhh8/LPRw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; '"""': 0.05; 'default.': 0.07; 'filename': 0.07; '"""get': 0.09; 'parsed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'typed': 0.09; 'python': 0.10; 'jan': 0.11; 'language,': 0.11; 'files.': 0.13; 'def': 0.13; 'iterable': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'meetings': 0.18; 'variable': 0.18; 'assign': 0.22; 'latter': 0.22; 'names.': 0.22; 'parameter': 0.22; 'am,': 0.23; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'supposed': 0.31; 'file': 0.34; 'list': 0.34; 'exist': 0.35; 'files,': 0.35; 'replace': 0.35; 'skip:p 30': 0.35; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'wrong': 0.38; 'files': 0.38; 'why': 0.39; 'does': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'determine': 0.61; 'hope': 0.61; 'body': 0.61; 'received:96': 0.63; 'beautiful': 0.66; 'spend': 0.67; 'obvious': 0.76; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-96-227-207-81.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109454 On 6/3/2016 10:20 AM, Sayth Renshaw wrote: > Very briefly because I hope to shot down eloquently. > > Python is beautiful and is supposed to be a duck typed language, Yes? > > Then if I create and assign to a new variable with a list action why does the duck not quack? > > It feels wrong to spend a line writing what is already obvious > > def getsMeet(files=file_list): > """Get a File or List of Files. > > From the list of files determine > what meetings exist and prepare them > to be parsed > """ > pyqFiles = [] > for filename in sorted(file_list): The parameter name if files, not file_list. The latter is just the default. > pyqFiles = pyqFiles.append(pq(filename=my_dir + filename)) > > return pyqFiles You can replace the body with return [pq(filename=my_dir+filename) for filename in sorted(files)] where files is any iterable of file names. -- Terry Jan Reedy