Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91935
| Path | csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!217.73.144.45.MISMATCH!feeder2.ecngs.de!ecngs!feeder.ecngs.de!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'item.': 0.07; 'performs': 0.07; 'predefined': 0.07; 'dict': 0.09; 'iterate': 0.09; 'keyed': 0.09; 'python': 0.11; 'python.': 0.11; 'files.': 0.13; 'attempt.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'organise': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'set,': 0.16; 'simpson': 0.16; 'wrote:': 0.16; 'to:name:python-list@python.org': 0.20; 'sets': 0.23; 'cheers,': 0.24; 'header:In-Reply-To:1': 0.24; 'written': 0.24; 'sort': 0.25; 'header:User-Agent:1': 0.26; 'question': 0.26; 'path,': 0.29; "skip:' 10": 0.30; 'values': 0.30; 'certain': 0.31; 'skip:[ 10': 0.32; 'structure': 0.32; 'received:com.au': 0.33; 'subject:use': 0.33; 'utility': 0.33; 'subject:?': 0.34; 'file': 0.34; 'add': 0.34; 'that,': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'path': 0.35; 'skip:> 10': 0.35; 'really': 0.35; 'list': 0.35; 'but': 0.36; 'list,': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'files': 0.38; 'to:addr:python.org': 0.39; 'data': 0.40; 'some': 0.40; 'content-disposition:inline': 0.60; 'your': 0.60; 'more': 0.62; 'here': 0.66; 'cameron': 0.66; 'outline': 0.66; 'sets,': 0.84 |
| Date | Wed, 3 Jun 2015 19:24:46 +1000 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | Re: What sort of data structure to use? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| Content-Disposition | inline |
| In-Reply-To | <41302A7145AC054FA7A96CFD03835A0A0B97DECA@EX10MBX02.EU.NEC.COM> |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| References | <41302A7145AC054FA7A96CFD03835A0A0B97DECA@EX10MBX02.EU.NEC.COM> |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=ItbjC+Lg c=1 sm=1 tr=0 a=rgDbx50tNA2z7xLXQOoruw==:117 a=rgDbx50tNA2z7xLXQOoruw==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=J0QyKEt1u0cA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=XAFQembCKUMA:10 a=nrACCIEEAAAA:8 a=oNTwGRP3gzOpUKDbaScA:9 a=CjuIK1q_8ugA:10 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.95.1433323492.13271.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433323492 news.xs4all.nl 2895 [2001:888:2000:d::a6]:59823 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91935 |
Show key headers only | View raw
On 03Jun2015 08:19, David Aldrich <David.Aldrich@EMEA.NEC.COM> wrote: >I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: > ># File Set A >pathA = 'pathA' >fileListA = ['fileA1.txt', 'fileA2.txt'] > ># File Set B >pathB = 'pathB' >fileListB = ['fileB1.txt', 'fileB2.txt', 'fileB3.txt'] > >myFunc1(pathA, fileListA) >myFunc2(pathA, fileListA) > >myFunc1(pathB, fileListB) >myFunc2(pathB, fileListB) > >I want to add more file sets, so I really want to add the sets to a list and iterate over the list, calling myFunc1 & myFunc2 for each item. > >My question is: what sort of data structure could I use to organise this, given that I want to associate a set of files with each path and that, for each set, there is an arbitrary number of files? Based on your description I would use a dict keyed on the path, whose values were a set of files. A set is a preprovided data type in Python. Look it up and use it. There are other alternatives, but that would be a first attempt. Cheers, Cameron Simpson <cs@zip.com.au>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: What sort of data structure to use? Cameron Simpson <cs@zip.com.au> - 2015-06-03 19:24 +1000
csiph-web