Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'attributes': 0.05; 'python': 0.08; '>>>>': 0.09; 'dict': 0.09; 'presume': 0.09; 'stored': 0.13; 'typing': 0.15; 'chris,': 0.16; 'confused,': 0.16; 'confusing.': 0.16; 'form?': 0.16; 'subject:classes': 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'wrote:': 0.18; 'instance': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'here?': 0.23; 'referring': 0.23; 'cc:2**0': 0.24; 'received:74.125.82.174': 0.24; 'object,': 0.24; 'code': 0.25; "i'm": 0.26; 'asking': 0.28; 'message-id:@mail.gmail.com': 0.28; 'print': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; '"good': 0.30; 'object.': 0.30; 'list': 0.32; 'object': 0.33; 'probably': 0.34; 'received:74.125.82': 0.35; 'question': 0.36; 'class.': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'should': 0.39; 'why': 0.39; 'your': 0.61; '2012': 0.67; 'relevant': 0.70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=stBKlC2rJTQZ31KW48rwtzJJPECAv39hZsaNPgEzJtA=; b=nTFMfSz1aR9/aVkWqkzyDqjl0g7tkBqUJ+GTLD7AwHoD5znvefG+RkYXQ9yTGbInIN JxgfKMmueGqF7h6bnUGeWn7f16VNFcqdP0IGRDKhV6Ar8fmE5GbVnQi7Q8NopGL2e+bO dTjwPtMvEILw8dyKgFrXZOVyn7c1XIMlHwxHU= MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Mon, 9 Jan 2012 16:55:38 -0700 Subject: Re: classes and __iter__ To: "david.garvey@gmail.com" Content-Type: text/plain; charset=ISO-8859-1 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326153370 news.xs4all.nl 6988 [2001:888:2000:d::a6]:41266 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18721 On Mon, Jan 9, 2012 at 4:30 PM, david.garvey@gmail.com wrote: > Chris, > > Both a list and dict are both iterable.=A0 I get a python dictionary obje= ct of > both iterables.;) It is nice... but I don't know if this is good form? > Should I be asking the duck question here? >>>> print helo.__dict__ [SNIP] I think you're confused, which is probably why your question is so confusing. helo.__dict__ has nothing to do with iterables or the __iter__ method of your class. This is just the instance dictionary of the "helo" object, which contains all the attributes stored on that object. I'm still not sure exactly what it is that you're asking whether it is "good form"? I also don't know what the "duck question" is -- I presume you're referring to duck typing ("Does it quack like a duck?"), but I don't see how that is relevant to the code you posted. Cheers, Ian