From: Diez B. R. <de...@we...> - 2004-07-02 16:07:39
|
> I hear that Python has both the 'thread' and 'threading' modules, and > that the later was inspired by Java. I guess what I'm asking for is > personal anecdotes of how some of you guys prefer to handle this > important area of Jython programming. (I can look up the Python > documentation on my own, but I really would like some advice from > someone who's walked this road before) While python has no built-in sync-mechanisms as you observed correctly, you can reach quite similarily declarative results using the more flexibility of the language. I personally created wrappers around my functions that perform the neccessary syncing. By placing special tags in the docstring (similar to javadoc, but more powerful due to the fact that they are available at runtime) and using factories, I determined which function to wrap. So while this is somewhat less convinient than the synchronized keyword, it is usable enough and given the advantages of python over java in general, I prefer it. Now on c.l.python and simlar groups of interests there are discussions about introduction of decorators - these are more or less user-definable declarations on function/method-level that are declared and used in a standarized fashion. This would allow for sync-magic beeing performed in a concise and well-known manner. If and when and how these become part of python and later on jython - well, thats a subject I can't say much on. Regards, Diez |