iters on ints? (reducing the need for range/xrange)

Mark Jackson mjackson at wrc.xerox.com
Fri Nov 9 09:18:55 EST 2001


"Rainer Deyke" <root at rainerdeyke.com> writes:
> "Luigi Ballabio" <ballabio at mac.com> wrote in message
> news:mailman.1005305487.25887.python-list at python.org...
> > This said, while it makes sense in english to say "do this for every line
> > IN this file", it just doesn't sound right to me to say "do this for every
> > number IN 10"---even though I've been once familiar with the definitions
> of
> > the set of all integers. I'd rather say "for every number UP TO 10" but
> > that would mean introducing a new keyword which I'm not going to suggest,
> > not me, sir.
> 
> I consider that a fairly weak argument.  Programming languages should be
> simple, internally consistent, fairly easy to learn, well defined, and able
> to express programs with minimum redundacy.  English is none of these, so
> English should not be used a basis for creating a programming language.  As
> an example, the for-else construct in Python is a good language construct,
> even if it has no equivalent in English.

I agree with the general point but not with the example.  The sense in
which else is used with for and while in Python has always struck me as
*inconsistent* with the way it is used with if.  (I realize that if you
look at it the "right" way it's consistent, but that way seems unnatural
to me.)

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
    After a recent trip to New York one French journalist remarked that
    leafing through a copy of /Forbes/ or /Fortune/ is like reading the
    operating manual of a strangely sanctimonious pirate ship.
					- Adam Gopnik





More information about the Python-list mailing list