__next__ and StopIteration

Chris Angelico rosuav at gmail.com
Mon Feb 9 20:58:44 EST 2015


On Tue, Feb 10, 2015 at 12:11 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>> Yes, it is allowed. But when you write code that's documented as being
>> "broken", you should expect annoying, subtle errors, maybe a long way
>> down the track.
>
> Well, that depends, don't it?
>
> Am I really going to care if the iterator used to generate those random
> numbers is technically "broken"? Probably not. And if I do, some time in
> the distant future, oh well, I'll "fix" it then.

If you inhale asbestos, you should expect annoying, maybe subtle,
errors, maybe a long way down the track. Good news is, the lab boys
say the symptoms of asbestos poisoning show a median latency of 44.6
years, so if you're thirty or older, you're laughing. Worst case
scenario, you miss out on a few rounds of canasta. Do you care that
your lungs are technically "broken"? Probably not. It's something to
be aware of when you consider working in certain environments, but "be
aware of" doesn't mean "absolutely always avoid".

Okay, maybe it does with asbestos... but not with broken iterators. :)

ChrisA



More information about the Python-list mailing list