What makes an iterator an iterator?

Steven D'Aprano steve at REMOVEME.cybersource.com.au
Wed Apr 18 10:16:19 CEST 2007

On Wed, 18 Apr 2007 16:58:23 +1000, Ben Finney wrote:

> Steven D'Aprano <steve at REMOVEME.cybersource.com.au> writes:
>> class Parrot(object):
>>     def __iter__(self):
>>         return self
>>     def __init__(self):
>>         self.next = self._next()
>>     def _next(self):
>>         for word in "Norwegian Blue's have beautiful plumage!".split():
>>             yield word
> Clearly the problem is you've misused an apostrophe. Python doesn't
> like the plural getting an apostrophe.
>     <URL:http://www.angryflower.com/bobsqu.gif>

I thought the rule wa's that any time you 'see an 'S, you put an
apo'strophe before it. If that's wrong, 'shouldn't it rai'se an exception?

'Steven D'Aprano 

More information about the Python-list mailing list