*Here is a good tutorial: http://shutupandship.com/articles/iterators/index.html * On Mon, Jan 9, 2012 at 5:22 PM, david.gar...@gmail.com < david.gar...@gmail.com> wrote:
> I see your meaning for __iter__ method.;) > > > On Mon, Jan 9, 2012 at 4:57 PM, david.gar...@gmail.com < > david.gar...@gmail.com> wrote: > >> Thanks Ian & Chris for the conversation... >> >> >> >> >> On Mon, Jan 9, 2012 at 4:15 PM, Chris Rebert <c...@rebertia.com> wrote: >> >>> On Mon, Jan 9, 2012 at 3:30 PM, david.gar...@gmail.com >>> <david.gar...@gmail.com> wrote: >>> > Chris, >>> > >>> > Both a list and dict are both iterable. I get a python dictionary >>> object of >>> > both iterables.;) >>> >>> No, you get a Python object with both iterables as instance variables. >>> Instance variables happen to be stored using a dict (which is >>> accessible as .__dict__), but that's to some extent an implementation >>> detail whose relevance here I fail to see. My point was that, as Ian >>> explained, your __iter__() method, as written, is horribly broken. >>> >>> > It is nice... but I don't know if this is good form? >>> >>> I'm confused as to why you wrote a class (particularly when its name >>> is an *action* rather than a noun; big red flag right there!) for your >>> task in the first place. I think you'd be best served by moving your >>> parsing code into a function and using a >>> http://pypi.python.org/pypi/sorteddict , which provides the >>> sorted-keys property you seemed to be trying to accomplish. >>> >>> Also, please avoid top-posting in the future. (See >>> http://en.wikipedia.org/wiki/Posting_style ) >>> >>> Cheers, >>> Chris >>> -- >>> http://rebertia.com >>> >> >> >> >> -- >> David Garvey >> > > > > -- > David Garvey > -- David Garvey
-- http://mail.python.org/mailman/listinfo/python-list