>Так как вам Питон? А какой Питон?
В стиле хаскеля
def sent_desplit(x_in):
""" sent_split:: Sent::[([],[],[]),] -> Text::([],[],[]) """
concat=operator.concat
f1=lambda (a,b,c),(x,y,z):tuple([concat(a,x),concat(b,y),concat(c,z)])
f2=lambda t:reduce(f1,t,([],[],[],))
return f2(x_in)
C
def f2(x,(y,z)):
global triger
if not triger: triger |= True; x+=[[u'',u'',True],]; x[-1][2]=z
x[-1][0]+= y; return x
Java
class ddict(dict):
def get_formating(self,key):
lst_val=self[key]
lst_format=[u'',]
for i in xrange(len(lst_val)):
if i==1:
lst_format=lst_format+[u'{']+[u'}']
lst_val=lst_val+[u'']
elif i>1:
lst_format.insert(i,u',')
d=map(lambda x,y:x+y,lst_format,lst_val)
return string.join(d)
Можно и в Лисп-, Смолтолк-,С++, только где в стиле Питона?
Может, правда, в том, что примеры выдраны из одного файла, который сейчас просто открыт,не совсем поэтому правильные, но идеология просматривается.