Path: csiph.com!x330-a1.tempe.blueboxinc.net!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.087 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; '>>>>': 0.09; 'def': 0.13; 'subject:classes': 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'received:209.85.212.46': 0.23; 'received:mail- vw0-f46.google.com': 0.23; 'cc:2**0': 0.24; 'do,': 0.25; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'class': 0.29; 'chris': 0.30; 'url:library': 0.31; 'idea': 0.32; 'received:209.85.212': 0.34; 'all.': 0.34; 'url:python': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'skip:_ 10': 0.37; 'received:209.85': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'received:209': 0.40; '8bit%:84': 0.64; '2012': 0.67; 'relevant': 0.70; 'sender:addr:chris': 0.84; 'url:datamodel': 0.84; 'url:functions': 0.84; 'url:html#object': 0.84; 'url:reference': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=/gHEvo4Jnxp/1xZ7hEEsNFkxpIZsJp83ZKppgaRuLxU=; b=d9YO0Pk8sbUBl2OA/qyaBWO+g+VYjUtjFfI7TQJ0hdglNdTdw9MwC/irny90yjR8Ov Y9hEBIDItlK694jEQ+1LdTIgXpPLhrns7a2fZFCt0R1FaVQjlnGZAAFAF0Evj1Uu0Ul8 9Pmq4gHreV9+GohVvtuqu9Ll/UG6ckGDMyT5g= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: References: Date: Mon, 9 Jan 2012 15:17:48 -0800 X-Google-Sender-Auth: CGi75eBlhyOnLaN6YJDnBR_lBoA Subject: Re: classes and __iter__ From: Chris Rebert To: "david.garvey@gmail.com" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326151071 news.xs4all.nl 6921 [2001:888:2000:d::a6]:45513 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18716 On Mon, Jan 9, 2012 at 2:51 PM, david.garvey@gmail.com wrote: >>>> class Parse_Nagios_Header: > ...=C2=A0=C2=A0=C2=A0=C2=A0 def __init__(self): > ...=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.keylist =3D [] > ...=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.d =3D {} > ...=C2=A0=C2=A0=C2=A0=C2=A0 def __iter__(self): > ...=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return iter(self.keyl= ist, self.d) No idea what you're expecting this __iter__() to do, but it doesn't work at= all. Relevant docs: http://docs.python.org/library/functions.html#iter http://docs.python.org/reference/datamodel.html#object.__iter__ Cheers, Chris