From: Kevin B. <kb...@ca...> - 2002-02-12 17:49:02
|
(expression) is a parenthized expression, not a tuple. Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> type( (1) ) <type 'int'> >>> type( (1,) ) <type 'tuple'> >>> Funky syntax, but you really don't want (5 + 10) to be a tuple. kb "Russo, Tom" wrote: > > Hi, > > When I run the following: > > <file name="demo.py"> > import thread > > thread.start_new_thread(lambda x,y:(x,y), (1,2)) # succeeds > thread.start_new_thread(lambda x:x, (1)) # fails > </file> > > I get: > > <output> > Traceback (innermost last): > File "demo.py", line 4, in ? > TypeError: start_new_thread(): 2nd arg can't be coerced to > org.python.core.PyTuple > </output> > > Is there some reason I should be able to use a function of two arguments > when starting a thread, but not a function of one argument? Does jython not > recognize (1) as a tuple in this case? > > thanks > _t > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |