[Python-Dev] Re: PEP 260: simplify xrange()

James Logajan JamesL@Lugoj.Com
Tue, 26 Jun 2001 19:42:20 -0700


Tim Peters wrote:
> [James Logajan]
> > Are there still known bugs that will take some effort to repair? Is
> > xrange constantly touched when changes are made elsewhere? If no to
> > both, then I suggest don't fix what ain't broken; life is too short.
> > (Unless it is annoying you to distraction, then do the deed and get
> > it over with.)
> 
> I think it's more the latter.  I partly provoked this by bitterly pointing
> out that there's more code in the CVS tree devoted to supporting the single
> xrange() gimmick than Neil Schemenauer added to support the get-out-of-town
> more powerful new generators.  Masses of crufty code nobody benefits from
> are a burden on the soul.

Design mistakes one has made do tend to weigh on one's soul (speaking from
more than two decades of programming experience) so I understand the primal
urge to correct them when one can, and even when one shouldn't. So although
I'm quite annoyed by all these new-fangled gimmicks being added to the
language (i.e. Python generators being added to solve California's power
problems) I have no problem with xrange being fenced in. (I find the very
existence of the PEP process somewhat unsettling; there are now thousands of
programmers trying to use the language. Why burden them with insuring their
programs remain compatible with yet-another-damn-set-of-proposals every
year? Or worse: trying to rewrite their code "more elegantly" using all the
latest gimmicks. Why in my day, if you wanted to, say, save execution state,
you figured out how to do it and didn't go crying to the language designer.
Damn these young lazy programmers. Don't know how good they have it.
Wouldn't know how to save their execution state if their lives depended on
it. Harumph.)

Speaking of "generators", I just want to say that I think that "generator"
makes for lousy terminology. If I understand correctly, "generators" are
coroutines that have peer-to-peer synchronized messaging (synchronizing and
communicating at the "yield" points). To my mind, "generators" does not
evoke that image at all. Assuming I understand it in my early senility....

> although-it-would-be-impolite-to-ask-we-why-still-ship-a-directory-
>     full-of-crufty-old-irix5-demos-in-the-std-library<wink>-ly

Perhaps because the Irix community would be quite Irate if they were
removed?