Re: Attachments (was: How can an int be '+' with a tuple?)

2018-06-04 Thread Richard Damon
On 6/4/18 12:34 PM, Peter Pearson wrote: > On Sun, 3 Jun 2018 20:20:32 +0200, Peter J. Holzer wrote: > [snip] >> On 2018-06-03 13:57:26 +1000, Ben Finney wrote: >>> (For good reasons, attachments are dropped when messages are distributed >>> on the forum.) >> By "the forum" you mean Gmane? (I got

Re: Attachments (was: How can an int be '+' with a tuple?)

2018-06-04 Thread Peter Pearson
On Sun, 3 Jun 2018 20:20:32 +0200, Peter J. Holzer wrote: [snip] > On 2018-06-03 13:57:26 +1000, Ben Finney wrote: >> (For good reasons, attachments are dropped when messages are distributed >> on the forum.) > > By "the forum" you mean Gmane? (I got the attachment over the mailing > list)

Attachments (was: How can an int be '+' with a tuple?)

2018-06-03 Thread Peter J. Holzer
On 2018-06-03 13:57:26 +1000, Ben Finney wrote: > (For good reasons, attachments are dropped when messages are distributed > on the forum.) By "the forum" you mean Gmane? (I got the attachment over the mailing list) hp -- _ | Peter J. Holzer| we build much bigger, better

Re: How can an int be '+' with a tuple?

2018-06-03 Thread Jach Fong
Forgive my ignorance of "*any" notation. I don't have real experience of using it in my codes so far, and didn't know those parameters were packed as a tuple:-( Steven D'Aprano 於 2018/6/3 下午 01:08 寫道: On Sun, 03 Jun 2018 04:59:34 +, Steven D'Aprano wrote: On Sun, 03 Jun 2018 10:55:04

Re: How can an int be '+' with a tuple?

2018-06-03 Thread Jach Fong
Yes, (I think) I know the *any usage, but don't know their type will be changed after unpack? Gary Herron 於 2018/6/3 下午 12:05 寫道: In fact, the value of *any* is *not* an integer.  The *any notation causes Python to pack all the arguments into a tuple. This feature is usually used when there

Re: How can an int be '+' with a tuple?

2018-06-03 Thread Jach Fong
> (For good reasons, attachments are dropped when messages are distributed > on the forum.) For whom who can not get the attachment:-) ###a simplified version of "Programming Python 4ed, Example 10-20. import _thread as thread import queue threadQueue = queue.Queue(maxsize=0) def

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Jach Fong
After a quick check I got: D:\Works\Python\PP4E-Examples-1.4\Examples\PP4E>py Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> t = ('myname',) >>> n = (3,) >>> n + t (3,

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Steven D'Aprano
On Sun, 03 Jun 2018 04:59:34 +, 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

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Steven D'Aprano
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

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Gary Herron
In fact, the value of *any* is *not* an integer.  The *any notation causes Python to pack all the arguments into a tuple. This feature is usually used when there are multiple (and an unknown number) of parameters, but it works perfectly well with a single parameter. Here's an example: >>>

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Ben Finney
Jach Fong writes: > The attached is a script Thanks for making an example script. Instead of attaching it, please post it along with your message so that everyone can read it. You can make scripts suitable for posting in your message, by keeping them short and simple http://sscce.org/>. (For

Re: How can an int be '+' with a tuple?

2018-06-02 Thread Chris Angelico
On Sun, Jun 3, 2018 at 12:55 PM, 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

How can an int be '+' with a tuple?

2018-06-02 Thread Jach Fong
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? Best Regards,