"Gregory Petrosyan" <[EMAIL PROTECTED]> writes:
> As you can see, PEP 204 was rejected, mostly because of not-so-obvious
> syntax. But IMO the idea behind this pep is very nice. So, maybe
> there's a reason to adopt slightly modified Haskell's syntax? 

I like this with some issues: Python loops tend to be 0-based, so
while it's convenient to express the sequence [1..n], what you usually
want is [0..(n-1)] which is uglier.

If you want to count down from f(n) to zero, in Haskell you might say

  [b, b-1 .. 0] where b=f(n)

There's no "where" in Python, so what do you do?

  [f(n)-1, f(n)-2 .. 0]

evaluates f twice (and might not even get the same result both times),
while the traditional

  xrange(f(n)-1, -1, -1)

only evaluates it once but is IMO repulsive.

Anyway I've never liked having to use range or xrange to control
Python loops.  It's just kludgy and confusing.  So I think your idea
has potential but there's issues that have to be worked out.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to