On Sun, 03 Jun 2018 04:59:34 +0000, Steven D'Aprano wrote: > On Sun, 03 Jun 2018 10:55:04 +0800, Jach Fong wrote: > >> The attached is a script which can run under Python 3.4/Windows Vista >> correctly. One thing make me puzzled is that the "any + context" at >> line 18. The "any" was passed as an integer from line 43 and the >> "context" was defined as a tuple at line 35. This concatenation works! >> how? > > 90% of the script you attached is irrelevant to your question. None of > the tkinter or threading code is important. The only important parts > are: > > def threaded(action, args, context, onExit, onProgress): > def progress(*any): > threadQueue.put((onProgress, any + context)) > > Here we can tell that ``any`` is a tuple.
Oops, I misread your question. You thought any was an int. But the * (star) notation in function parameters makes the parameter collect any unnamed arguments into a single tuple. def test(first, *args): print(args) test(1, 2, 3, "hello", 99) => prints the tuple (2, 3, "hello", 99) -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list