Re: Passing a callable object to Thread

2008-02-19 Thread castironpi
>         The "ice-cream" example given earlier does /not/ fit the idea of a > tuple to me; "Vanilla", "Chocolate", and "Strawberry" isn't a tuple -- > it's a list... Flavor* flavors[]= { Vanilla, Chocolate, Strawberry }; flavorct= 3; -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
> a= object() > (a,) is a > > False > > (a,) is not identical with a. > > (a,) is (a,) > > False > > The tuple on the left is not identical with the tuple on the right, even > though they are equivalent. > > a is a > > True > > The variable on the left is identical with the one

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
On Feb 18, 5:23 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 18, 4:26 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> Lie wrote: > >>> On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > Jeff Schwab <[EMAIL PROTECTED]> wri

Re: Passing a callable object to Thread

2008-02-18 Thread Jeff Schwab
Paul Rubin wrote: > Jeff Schwab <[EMAIL PROTECTED]> writes: >> I think you're a little confused about the meaning of "numeric >> literal." (5+1) is not a numeric literal. Neither is >> (99+1). >> >> The flyweight pattern does not guarantee that all equivalent instances

Re: Passing a callable object to Thread

2008-02-18 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > I think you're a little confused about the meaning of "numeric > literal." (5+1) is not a numeric literal. Neither is > (99+1). > > The flyweight pattern does not guarantee that all equivalent instances > of an object type will

Re: Passing a callable object to Thread

2008-02-18 Thread Jeff Schwab
Paul Rubin wrote: > Jeff Schwab <[EMAIL PROTECTED]> writes: In CS, a tuple is a kind of data structure that is specifically not identical with any of its elements. That's the sort of tuple used in Python. > > The usual CS meaning of "tuple" is more like the physics meaning than > l

Re: Passing a callable object to Thread

2008-02-18 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > >> In CS, a tuple is a kind of data structure that is specifically not > >> identical with any of its elements. That's the sort of tuple used in > >> Python. The usual CS meaning of "tuple" is more like the physics meaning than like the Python meaning, I

Re: Passing a callable object to Thread

2008-02-18 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > On Feb 18, 4:26 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: >> Lie wrote: >>> On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: Paul Rubin wrote: > Jeff Schwab <[EMAIL PROTECTED]> writes: >> Why not? They seem intuitive to me. I would find it weird

Re: Passing a callable object to Thread

2008-02-18 Thread castironpi
On Feb 18, 4:26 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Lie wrote: > > On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > >> Paul Rubin wrote: > >>> Jeff Schwab <[EMAIL PROTECTED]> writes: > Why not?  They seem intuitive to me.  I would find it weird if you > couldn't have

Re: Passing a callable object to Thread

2008-02-18 Thread Jeff Schwab
Lie wrote: > On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: >> Paul Rubin wrote: >>> Jeff Schwab <[EMAIL PROTECTED]> writes: Why not? They seem intuitive to me. I would find it weird if you couldn't have 0-tuple, and even weirder if you couldn't have a 1-tuple. Maybe

Re: Passing a callable object to Thread

2008-02-18 Thread Lie
On Feb 16, 12:29 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > Jeff Schwab <[EMAIL PROTECTED]> writes: > >> Why not? They seem intuitive to me. I would find it weird if you > >> couldn't have 0-tuple, and even weirder if you couldn't have a > >> 1-tuple. Maybe my brain has

Re: Passing a callable object to Thread

2008-02-16 Thread Benjamin
On Feb 15, 9:31 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2008-02-15 at 19:21 -0800, Benjamin wrote: > > You could type args=tuple("data/w7/"). > > That will produce an 8-tuple containing single-character strings, not a > 1-tuple containing one string. Opps. That iterable thing of stri

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > > The idea is that a 2-tuple (of numbers, say) is a pair of numbers, a > > 3-tuple is three numbers, and a 1-tuple is one number. That would > > mean a number and a 1-tuple of numbers are the same thing, not > > separate types. > > No, that doesn't follow

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Paul Rubin wrote: > Jeff Schwab <[EMAIL PROTECTED]> writes: >> Why not? They seem intuitive to me. I would find it weird if you >> couldn't have 0-tuple, and even weirder if you couldn't have a >> 1-tuple. Maybe my brain has been warped by too much C++ code. > > The idea is that a 2-tuple (of

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > Why not? They seem intuitive to me. I would find it weird if you > couldn't have 0-tuple, and even weirder if you couldn't have a > 1-tuple. Maybe my brain has been warped by too much C++ code. The idea is that a 2-tuple (of numbers, say) is a pair of

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: > Paul Rubin wrote: >> Steve Holden <[EMAIL PROTECTED]> writes: >>> Assuming you're right, what alternative would you suggest? Would it >>> allow parenthesized expressions to retain their customary meaning? >> >> It is kind of weird that there is even such a thing as a 1-tuple.

Re: Passing a callable object to Thread

2008-02-15 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: >> Assuming you're right, what alternative would you suggest? Would it >> allow parenthesized expressions to retain their customary meaning? > > It is kind of weird that there is even such a thing as a 1-tuple. I agree that zero-length

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Assuming you're right, what alternative would you suggest? Would it > allow parenthesized expressions to retain their customary meaning? It is kind of weird that there is even such a thing as a 1-tuple. -- http://mail.python.org/mailman/listinfo/python-l

Re: Passing a callable object to Thread

2008-02-15 Thread Carsten Haese
On Fri, 2008-02-15 at 19:21 -0800, Benjamin wrote: > You could type args=tuple("data/w7/"). That will produce an 8-tuple containing single-character strings, not a 1-tuple containing one string. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/pyth

Re: Passing a callable object to Thread

2008-02-15 Thread Benjamin
On Feb 15, 6:51 pm, skawaii <[EMAIL PROTECTED]> wrote: > On Feb 15, 7:23 pm, Paul Rubin wrote: > > > t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) > > Thanks, that did it. After playing around in the interpreter a bit, I > realize now that args

Re: Passing a callable object to Thread

2008-02-15 Thread Steve Holden
skawaii wrote: > On Feb 15, 7:23 pm, Paul Rubin wrote: >> t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) > > Thanks, that did it. After playing around in the interpreter a bit, I > realize now that args=("data/w7/") doesn't create a tuple, like

Re: Passing a callable object to Thread

2008-02-15 Thread skawaii
On Feb 15, 7:23 pm, Paul Rubin wrote: > t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",)) Thanks, that did it. After playing around in the interpreter a bit, I realize now that args=("data/w7/") doesn't create a tuple, like I thought it would. I h

Re: Passing a callable object to Thread

2008-02-15 Thread Paul Rubin
skawaii <[EMAIL PROTECTED]> writes: > >>> t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/")) > TypeError: populate_all_tribes() takes exactly 1 argument (8 given) > > Can anybody clue me in on what I'm doing wrong? Does my function need > to have a different signature (i.e. *a

Passing a callable object to Thread

2008-02-15 Thread skawaii
I'm trying to execute a function in its own thread, due to this method taking a very long time to complete. I really don't see the need to inherit the Thread class, as basically every online example shows (at least the ones I found), nor do I want to. I want to pass the method into the Thread const