[Python-ideas] Reducing colon uses to increase readability

Arnaud Delobelle arnodel at googlemail.com
Tue Jul 1 08:09:20 CEST 2008


On 30 Jun 2008, at 02:41, Andre Roberge wrote:

> dict assignments
> ------------------------
>
> Here again, I would argue that using "->" instead of ":" would make
> the code more readable - at least for beginners.
>
> numbers = {'one' -> 1, 'two' -> 2}  instead of
> numbers = {'one': 1, 'two': 2}
>

I don't find the first version more readable.  I find it noisier.

> lambda assignments
> ---------------------------
>
> Once again, same choice.
>
> lambda x -> x+1
> is, I think, more readable than
> lambda x: x+1
>
> (but perhaps the last two [dicts and lambda] largely depends on the
> font choice...)

You could even drop the 'lambda' and simply write:

x -> x+1

This would please those who advocate the removal of lambda from the  
language ;)

-- 
Arnaud




More information about the Python-ideas mailing list