Re: is +=1 thread safe

2008-05-03 Thread AlFire
Alexander Schmolck wrote: AlFire <[EMAIL PROTECTED]> writes: The threading module already has a function to return the number of Thread objects currently alive. I have threads within threads - so it does not suit me :-(. How about using a scalar numpy array? They are mutable, so I

Re: is +=1 thread safe

2008-05-02 Thread AlFire
Duncan Booth wrote: [...] is equivalent to: x = x.__iadd__(1) thx all for answers and hints ... Generating hundreds of threads is, BTW, a very good way to get poor performance on any system. Don't do that. Create a few threads and put the actions for those threads into a Queue. If

is +=1 thread safe

2008-05-01 Thread AlFire
Hi, I have a piece of software which uses threads in very massive way - like hundreds of them generated every second. there is also a piece of code which maintains the number of outstanding threads, simply counter+=1 is executed when before starting the thread and counter-=1 after it fini

Re: Python Success stories

2008-04-23 Thread AlFire
Bob Woodham wrote: x = x++; has unspecified behaviour in C. what about C++ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Success stories

2008-04-23 Thread AlFire
Cristina Yenyxe González García wrote: 2008/4/23, Reedick, Andrew <[EMAIL PROTECTED]>: IIRC, Python is used in games like Eve Online (SciFi MMO) and Vampire: Bloodlines (RPG.) Years later, a dedicated fan is still fixing/updating the Bloodlines python scripts that control the dialogue and scr

Re: why objects of old style classes are instances of 'object'

2008-04-21 Thread AlFire
Diez B. Roggisch wrote: But not everything is a newstyle-class: class Foo: pass ... isinstance(Foo, object) True isinstance(Foo, type) False class Bar(object): pass ... isinstance(Bar, type) True thx for explanation. but more I look at it less and less

why objects of old style classes are instances of 'object'

2008-04-17 Thread AlFire
Hi, Q: from the subject, why objects of old style classes are instances of 'object'? >>> class a():pass >>> A=a() >>> isinstance(A,object) True I would expect False Thx, Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: why function got dictionary

2008-04-17 Thread AlFire
Diez B. Roggisch wrote: >> >> Q: why function got dictionary? What it is used for? > > because it is an object, and you can do e.g. > you mean an object in the following sense? >>> isinstance(g,object) True where could I read more about that? Andy -- http://mail.python.org/mailman/listinf

why function got dictionary

2008-04-17 Thread AlFire
Hi, I am seeking an explanation for following: Python 2.5.2 (r252:60911, Apr 8 2008, 21:49:41) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def g(): return ... >>> g.__dict__ {} Q: why function got dictionary? What it