Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > C global variables are global, not per-thread. aha, a static pointer gets initialized to NULL, so I can check if it's not NULL in the module initializer. Thanks for jogging my brain, Simon. > > -- > Gabriel Genellina -- ht

Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: > > > I have an extension module that gets initialized multiple > > times because I am using threads. > > And do you want thread local variables? no > > > How ca

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread pianomaestro
Did you try just creating a new socket every time you do a connect ? On Mar 28, 10:01 am, Jason Kristoff wrote: > I'm trying to make something that once it is disconnected will > automatically try to reconnect. I'll add some more features in later so > it doesn't hammer the server but right now

threads and extension module initialization

2008-03-28 Thread pianomaestro
I have an extension module that gets initialized multiple times because I am using threads. How can this module access global state (not per-thread state) ? It needs to create a singleton. Simon. -- http://mail.python.org/mailman/listinfo/python-list

extension module initialization called twice

2008-03-27 Thread pianomaestro
I have a cython extension module "mux" where the initialization is being called more than once (the initmux c function). I am wondering if my use of multiple threads causes this. Can't multiple threads share the same python module ? The threads are being created from an external C library. I just

Re: lazy arithmetic

2006-08-25 Thread pianomaestro
Simon Forman wrote: > But that's a function, not a class. When you assign add to an > attribute of Item it "magically" becomes a method of Item: > Yes, I am looking to understand this magic. Sounds like I need to dig into these descriptor thingies (again). (sound of brain exploding).. Simon.

Re: lazy arithmetic

2006-08-24 Thread pianomaestro
Simon Forman wrote: > > "Item.__add__ = Add" is a very strange thing to do, I'm not surprised > it didn't work. Yes it is strange. I also tried this even stranger thing: class Item(object): class __add__(object): def __init__(self, a, b=None): print self, a, b self.a = a

Re: lazy arithmetic

2006-08-24 Thread pianomaestro
Gabriel Genellina wrote: > At Friday 25/8/2006 00:36, [EMAIL PROTECTED] wrote: > > ># This is what I have in mind: > > > >class Item(object): > > def __add__(self, other): > > return Add(self, other) > > And this works fine... why make thinks complicated? Yes, I agree it's simpler, and up u

lazy arithmetic

2006-08-24 Thread pianomaestro
# This is what I have in mind: class Item(object): def __add__(self, other): return Add(self, other) class Add(Item): def __init__(self, a, b): self.a = a self.b = b a = Item() b = Item() c = a+b # Now, I am going absolutely crazy with this idea # and using it in a big way. So

Re: linking one extension module to another (Mac OSX)

2005-11-22 Thread pianomaestro
Martin v. Löwis wrote: > Simon Burton wrote: > > I'm having some trouble linking one extension module to another because > > the linker expects a "lib" prefix and my python modules cannot have > > this prefix. > > This is a Good Thing (tm) :-) Don't link extension modules to each > other; this is