I have two or more threads(created by subclassing threading.Thread) running in parallel and they often communicate with each other. They communicate by calling each others methods. As I have been doing it, I have each thread pass itself as an argument, so that all of that classes attributes are available right away.
This is probably the lazy way of doing is as I could figure which attributes a method needs to know, and only pass those. So my question is this, is passing a whole class instance to a method less efficient than just the relevant data?
It’s not less efficient, but it can increase coupling — that is, it might lead you to make your function more dependent on the details of the overall structure. This makes code more brittle — you might have to make more changes throughout the code to account for a change in the structure.