Ruby like syntactic sugar
amk at amk.ca
Wed Mar 3 00:22:31 CET 2004
On 2 Mar 2004 13:26:17 -0800,
F Jamitzky <fxj at mpe.mpg.de> wrote:
> 5 *times(lambda: printf("Hello World!") )
> [toast, cheese, wine] *each (lambda food: eat(food) )
These formulations are no improvement over the obvious code:
for i in range(5):
print 'Hello world!'
for food in [toast, cheese, wine]:
It's certainly possible to use Python language features to get Ruby-like
code, but this code isn't as clear, so why bother?
More information about the Python-list