On Feb 10, 9:28 pm, r0g <aioe....@technicalbloke.com> 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 mutation. 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: http://www.artima.com/weblogs/viewpost.jsp?thread=248953 -- http://mail.python.org/mailman/listinfo/python-list