Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
Well put. Got it. Thanks Kent tj * Kent Johnson <[EMAIL PROTECTED]> [051113 14:44]: > Tim Johnson wrote: > > * Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > > > >>Someone correct me if I'm wrong, but I believe there is no specific iterator > >>object, but rather objects that have a

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Kent Johnson
Tim Johnson wrote: > * Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > >>Someone correct me if I'm wrong, but I believe there is no specific iterator >>object, but rather objects that have a method for __iter___... > > > Some light is slowly dawning here (I think) from >

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
Johnson > Sent: Monday, 14 November 2005 10:37 a.m. > To: tutor@python.org > Subject: Re: [Tutor] iteritems() vs items() > > > * Kent Johnson <[EMAIL PROTECTED]> [051113 12:04]: > > Tim Johnson wrote: > > > Question: Can one subclass an iterator object? >

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Liam Clarke-Hutchinson
2005 10:37 a.m. To: tutor@python.org Subject: Re: [Tutor] iteritems() vs items() * Kent Johnson <[EMAIL PROTECTED]> [051113 12:04]: > Tim Johnson wrote: > > Question: Can one subclass an iterator object? > > thanks for making this a little clearer. > > Most *classes

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051113 12:04]: > Tim Johnson wrote: > > Question: Can one subclass an iterator object? > > thanks for making this a little clearer. > > Most *classes* can be subclassed. What do you have in mind? Oh, I'm just playing right now but what is the iter

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051113 12:16]: > On 14/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Now if I assign a value to the iteritems method, as in > > it = s.iteritems() > > I get an object of > > and dir(it) shows that (it) has one public method - next(). > > Yep. The nor

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread John Fouhy
On 14/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > Now if I assign a value to the iteritems method, as in > it = s.iteritems() > I get an object of > and dir(it) shows that (it) has one public method - next(). Yep. The normal way to use an iterator is in a for loop. So, if you've don

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Kent Johnson
Tim Johnson wrote: > Question: Can one subclass an iterator object? > thanks for making this a little clearer. Most *classes* can be subclassed. What do you have in mind? -- http://www.kentsjohnson.com ___ Tutor maillist - Tutor@python.org http:

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051112 20:33]: > Tim Johnson wrote: > >I need to get up to speed on iterators. I learned python 1.5~ via > >Alan G's book ... > >For an example, I've written a subclass of dict where keys are kept in > >a ordered fashion is a list called __keys: > > > >#Here is m

Re: [Tutor] iteritems() vs items()

2005-11-12 Thread Kent Johnson
Tim Johnson wrote: > I need to get up to speed on iterators. I learned python 1.5~ via > Alan G's book ... > For an example, I've written a subclass of dict where keys are kept in > a ordered fashion is a list called __keys: > > #Here is my items function: > def items(self): > """ Return a

Re: [Tutor] iteritems() vs items()

2005-11-12 Thread Alan Gauld
>I need to get up to speed on iterators. I learned python 1.5~ via > Alan G's book ... Yeah, me too! iterators are one of the newer features of Python that I use but haven't really played with in depth. But I guess I really should get down to it and add a section to my tutor covering both iter

[Tutor] iteritems() vs items()

2005-11-12 Thread Tim Johnson
I need to get up to speed on iterators. I learned python 1.5~ via Alan G's book ... For an example, I've written a subclass of dict where keys are kept in a ordered fashion is a list called __keys: #Here is my items function: def items(self): """ Return all pairs in order of addition"""