Message11289
It seems there's a bug in python 2.3
The following script works with python 2.2, not with 2.3
def flatten(L):
for i in L:
if type(i) == list:
for j in flatten(i):
yield j
else:
yield i
def mklist(n):
if n:
return [ str(n), mklist(n-1), str(n) ]
else:
return []
L = mklist(6)
print "".join(flatten(L))
flatten seems to work but join makes a segmentation fault.
It works fine with print "".join(list(flatten(L)))
or when L = mklist(4)
I'm using Python 2.3 with Linux (Redhat)
Best regards,
Christophe Delord. |
|
Date |
User |
Action |
Args |
2007-08-23 14:02:20 | admin | link | issue571885 messages |
2007-08-23 14:02:20 | admin | create | |
|