one to many (passing variables)

Ben Finney ben+python at benfinney.id.au
Thu Jul 24 05:58:31 EDT 2014


Martin S <shieldfire at gmail.com> writes:

> I have functions A B and C. If data generated in A is useable in both
> B and C how do I ensure this data is passed as needed? Or is it a
> symptom of bad code?

This is very vague; an accurate answer is “it depends”.

You seem to be asking about how to design your data structures and APIs.
This is less a Python-specific question and more a matter of experience
and judgement.

Here is an article on good API design; the principles apply to Python
<URL:http://blog.isnotworking.com/2007/05/api-design-guidelines.html>.
You know your API and its requirements better than we; see whether that
sheds any light on improvements to make.

It sounds like you are needing to decide how to arrange the data
structures. You need to find natural divisions and groupings, such that
you can refer to groupings of properties that make sense and that are
not too unwieldy.

-- 
 \         “Religious faith is the one species of human ignorance that |
  `\     will not admit of even the *possibility* of correction.” —Sam |
_o__)                                 Harris, _The End of Faith_, 2004 |
Ben Finney




More information about the Python-list mailing list