Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'nested': 0.07; 'python': 0.09; 'array.': 0.09; 'loop.': 0.09; 'unpacking': 0.09; 'def': 0.10; 'aug': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:209.85.161.174': 0.16; 'row': 0.16; 'subject:Objects': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'trying': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'mind.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'class': 0.29; "i'm": 0.29; 'to:addr:python-list': 0.33; 'entry': 0.33; 'received:google.com': 0.34; 'doing': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'sure': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'necessarily': 0.63; 'different': 0.63; 'natural': 0.65; 'taking': 0.65; 'construct': 0.84; 'remember,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=OlIvnAPaxvyuC+0ay7WzKqVjiLRPLOQi7uBrk1Nj6GE=; b=1DeK0+3R2B09mAD1W4RJsojuQV+WgShPXO3elZeRwJ0z5JqarXm56ZJfcwRCVB6Ru7 +QRFtXu7GMngF2jWv9p6a83dDAVxAhZMS9xG3T7eBW8SQlR0YEtAXZXhih4376FHHNI2 btqnAMNUPk+k1uXVplqNpDhrBVuZwscwYQlBDVfR8fdbrMR/ofjAxTtFtvMAtVaUDsci m1bp9jK277UhGfnBmaqTMS/+BfP0TxO/MOjmcZCb8SBgoRoboJxqBeQw9YlbRm1FAH4S Dl+jSrDCfOZoikOSUlVarHvsT8fF4RZ8prr2VkDmVfDHEnL68MUDZ9UJCCrDS/wbXKeu 4suA== MIME-Version: 1.0 In-Reply-To: <12ee0624-f523-4cf9-b46c-292315ef789e@googlegroups.com> References: <18409992-1e28-4721-8e64-60c69668da4e@googlegroups.com> <12ee0624-f523-4cf9-b46c-292315ef789e@googlegroups.com> Date: Thu, 23 Aug 2012 01:47:46 +1000 Subject: Re: Objects in Python From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 1345650469 news.xs4all.nl 6891 [2001:888:2000:d::a6]:57172 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27647 On Thu, Aug 23, 2012 at 1:25 AM, shaun wrote: > def breakuparray(self): > for row in self.array: > mer = row[0].ljust(25, ' ') > merc = row[1].ljust(13, ' ') > mertype = row[2] > merloc = row[3] > mercount = row[4] > mersec = row[5] > acq = row[6] The "for ... in ..." construct is a loop. I'm not sure what you're trying to accomplish here, but you're taking the last entry in self.array and unpacking that as a nested array. Perhaps not what you had in mind. For what you're doing there, though, a class is overkill. Remember, Python isn't Java; the most natural way to do everything isn't necessarily to write a class that unpacks things and packs them up again in a different way. ChrisA