Message76924
I compiled python 3.0 on a cygwin platform.
Here is my modest function:
def List_to_String(lis):
# return str.join(lis, '') # This is fast, but seems broke in 3.0
s = '' # This is really slow, but works in 3.0
for l in lis: s = s + l
return s
Here is my test case:
def test_List_to_String(self):
inp = ['f', 'r', 'e', 'd', ' ', 'i', 's']
out = 'fred is'
self.assertEqual(jefflib.List_to_String(inp), out)
Here is what happens when I try to run the commented out version (the
one with the join):
ERROR: test_List_to_String (__main__.TestJefflibFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./jefflib_test.py", line 96, in test_List_to_String
self.assertEqual(jefflib.List_to_String(inp), out)
File "/cygdrive/c/documents and
settings/deifikj/jeff/scripts/jefflib.py", lin
e 256, in List_to_String
return str.join(lis)
TypeError: descriptor 'join' requires a 'str' object but received a 'list'
Of course, it worked fine in python 2.6.
I am baffled. |
|
Date |
User |
Action |
Args |
2008-12-04 20:34:22 | lopgok | set | recipients:
+ lopgok |
2008-12-04 20:34:22 | lopgok | set | messageid: <1228422862.72.0.643354735344.issue4534@psf.upfronthosting.co.za> |
2008-12-04 20:34:22 | lopgok | link | issue4534 messages |
2008-12-04 20:34:20 | lopgok | create | |
|