[Python-Dev] list comprehensions again...

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Wed, 12 Jul 2000 09:00:53 +0300 (IDT)

On Tue, 11 Jul 2000 esr@thyrsus.com wrote:

> Skip Montanaro <skip@mojam.com>:
> > 
> >     Guido>     [(x,y) for x in (1,2,3) for y in (4,5,6)]
> >     Guido> Would it be really bad if we forced them to write it that way?
> > 
> > For that matter, perhaps requiring parens for all tuple definitions in Py3k
> > wouldn't be a bad idea.
> +1.  IMO, naked tuples assignments are Perlish -- initially cute, but
> confusing.  Syntactic junk food.

I disagree. That would make the readable

def fib(n):
	a, b = 0, 1
	for i in range(n):
		a, b = b, a+b
	return a, b

old_rabbits, young_rabbits = fib(100)

(Ditto for GCD)

A mess of parenthesis.

Commas build tuples. Parenthesis fix precedence. Never the two shall mix.

Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.