Functional schmunctional...

Michele Simionato michele.simionato at
Wed Feb 11 10:18:53 EST 2009

On Feb 10, 9:28 pm, r0g <aioe.... at> wrote:
> def ip2inet(a):
>   li = a.split('.')
>   assert len(li) == 4 or len(li) == 6
>   return reduce(add,[int(li[e])*(256**((len(li)-1)-e)) for e in
> xrange(0,len(li))])

Aagh! Notice that functional programming is not about filter, map,
reduce and other unreadable constructs: it is much more about avoiding

Your problem has been already solved by using the standard library;
however, if you want to know more about functional programming, I
could as well advertise my own series of "Adventures of a Pythonista
in Schemeland" which is facing exactly that topic right now:

More information about the Python-list mailing list