[Python-Dev] PEP 343 - Abstract Block Redux
Michael Hudson
mwh at python.net
Mon May 16 11:38:37 CEST 2005
Greg Ewing <greg.ewing at canterbury.ac.nz> writes:
> Guido van Rossum wrote:
>
>> PEP 340 is still my favorite, but it seems there's too much opposition
>> to it,
>
> I'm not opposed to PEP 340 in principle, but the
> ramifications seemed to be getting extraordinarily
> complicated, and it seems to be hamstrung by
> various backwards-compatibility constraints.
> E.g. it seems we can't make for-loops work the way
> they should in the face of generator finalisation
> or we break old code.
I think I zoned this part of the discussion out, but I've written code
like this:
lineiter = iter(aFile)
for line in lineiter:
if sectionmarker in line:
break
parseSection1Line(line)
for line in lineiter:
if sectionmarker in line:
break
parseSection2Line(line)
(though, not *quite* that regular...)
This is, to me, neat and clear. I don't find the idea that iterators
are tied to exactly 1 for loop an improvement (even though they
usually will be).
Cheers,
mwh
--
<thirmite> what's a web widget??
<glyph> thirmite: internet on a stick, on fire
<Acapnotic> with web sauce!
-- from Twisted.Quotes
More information about the Python-Dev
mailing list