Backwards compatibility [was Re: is parameter an iterable?]

Steven D'Aprano steve at REMOVEMEcyber.com.au
Tue Nov 22 07:07:30 CET 2005


Alex Martelli wrote:

> "Consuming" didn't really come into consideration for the
> backwards compatibility part because only objects indexable with
> integers, 0 and up (and raising IndexError at some point) were usable in
> for statements in old Pythons, there was no "consuming".

Ah yes, of course. How quickly we forget: you couldn't 
say "for line in file...". No generators either.

But there was still at least one object that was 
consumable: xreadlines.

Still, I think using an xreadlines object is an unusual 
enough case that I'm not going to lose any sleep about 
it. Document it as a known issue and forget it *wink*

[snip]

> This kind of spaghetti code is what gives backwards compatibility its
> bad name, of course.  Be sure that you're getting paid for this in
> proportion to its ugliness, and your finances should be set for life.

Hah, I wish!


Thanks for the assistance, I learnt a lot. Let's hope I 
don't have to use it ever again...


-- 
Steven.




More information about the Python-list mailing list