Status of PEP's?

Alan Daniels daniels at mindspring.com
Thu Feb 28 17:22:34 CET 2002


David Eppstein <eppstein at ics.uci.edu> wrote in message news:<eppstein-F06C24.20302727022002 at news.service.uci.edu>...
> In article <a5k7ej$d5a$1 at animus.fel.iae.nl>,
>  Carel Fellinger <cfelling at iae.nl> wrote:
> 
> > So please explain why you think it natural to loop over a number.
> 
> Maybe it's as natural as Perl's ability to concatenate numbers?

Perl does not concatenate numbers, it concantenates *scalars*. There
is a difference. It's a standard Perlism that a scalar can be either a
numerical value or a string, depending on how it's used. Python's is not
as loosely typed (thank Guido), and just because Perl is full of
do-what-you-think-I-mean implicit conversions is no justification for
having similar idioms in Python.

I'd also like to put in my (unrequested) two cents and go on record as
disliking the "for i in 5" syntax. Not just as a matter of taste, but
because it provides unintuitive behavior, as pointed out previously.
The two lines...
    for i in 5: print i
    for i in 5, 6: print i
...would behave differently under the proposal.

A question that isn't directed at anyone in particular: Am I missing
something? I'm trying to understand this better, I really am, but is
it really all that terrible to type range or xrange?

I'll admit my bias, though. I didn't like syntax such as having "for
line in file" transparently iterate over lines when I first saw it
introduced, and I don't like it now. Hell, I've never even liked that
iterating over a string gives you its characters, and that's been in
the language as long as I can remember. All the wonderful improvements
in 2.2 made it worth the switch for me (generators are awesome), but
I'm a strong believer in the "explicit is better than implicit" rule.
I don't understand this desire so many have to give every built-in
data type an implicit iterator.



More information about the Python-list mailing list