Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18721 > unrolled thread

Re: classes and __iter__

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2012-01-09 16:55 -0700
Last post2012-01-09 16:55 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: classes and __iter__ Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-09 16:55 -0700

#18721 — Re: classes and __iter__

FromIan Kelly <ian.g.kelly@gmail.com>
Date2012-01-09 16:55 -0700
SubjectRe: classes and __iter__
Message-ID<mailman.4560.1326153370.27778.python-list@python.org>
On Mon, Jan 9, 2012 at 4:30 PM, david.garvey@gmail.com
<david.garvey@gmail.com> wrote:
> Chris,
>
> Both a list and dict are both iterable.  I get a python dictionary object 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web