RPy is an interface that allows you to call R functions and handle R objects in Python.
Archive for July, 2009
We just came across a weird Python behaviour (of course only weird if you don’t know why). If you use mutable objects such as lists as the default parameter in a function declaration, you might end up with some unintented behaviour. Everytime the function modifies the object, the default value is in effect modified as well (e.g. appending to the list). This is also explained in the Python documentation:
Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that that same “pre-computed” value is used for each call. This is especially important to understand when a default parameter is a mutable object, such as a list or a dictionary: if the function modifies the object (e.g. by appending an item to a list), the default value is in effect modified. This is generally not what was intended. A way around this is to use None as the default, and explicitly test for it in the body of the function, …
Find the whole thing here.
Manual Reference Pages (including a list of functions that are not thread-safe)
Tutorial on pthreads
And if you wonder why you cannot create more than X threads on your system (for me this was always 382), this forum provides a solution.
Basically, the problem is that each thread created will occupy space for its stack. On my system, the default thread stack size is 8MB. Therefore, after 382, I simply run out of space.
Solution: Change the stack size to a smaller value, unless you really need 8MB.
size = PTHREAD_STACK_MIN + WHAT_ELSE_YOU_NEED;
Another interesting page on pthreads is this.
UNIX Network Programming Volume 1, Third Edition: The Sockets Networking API
by W. Richard Stevens; Bill Fenner; Andrew M. Rudoff
can be found online at safari books.
just realised that it is not the complete version, just previews. sorry!