Python on Ubuntu

Adriano Varoli Piazza moranar at gmail.com
Wed Sep 20 18:10:03 UTC 2006


2006/9/20, Felipe Alfaro Solana <felipe.alfaro at gmail.com>:
>
>
> > > x = [ 1, 2, 3, 4, 5 ]
> > > x.each { |i| print i }
> > >
> > > What do you think this code does?
> >
> > line 1 is a set, list or bag.
> > line 2 is a method definition calculating the absolute value of i, and
> > printing i which is undefined in both cases
>
>
> LOL
> Obviously, you're kidding, aren't you?... :-D
>
You did ask. Someone not acquainted with ruby would think anything
when meeting those blocks. I could also say "x.each {pipe i pipe to
print i}", so " do, for each thing in x, a pipe to i, which is not
defined, and then a pipe to print i, which is still undefined". That,
thinking as a shell scripter. And yes, we're kidding, of course. At
least I am.

Seriously, that kind of stuff is not very appreciable to people who
don't even know what closures are, and if you're a fan of python, you
tend not to appreciate strange code like that. It requires heavy human
parsing, even if it's great.
-- 
Adriano Varoli Piazza
The Inside Out: http://moranar.com.ar
ICQ: 4410132
MSN: moranar at gmail.com




More information about the ubuntu-users mailing list