Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75135

Re: one to many (passing variables)

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: one to many (passing variables)
Date 2014-07-24 19:58 +1000
References <CAHXoDSB+-Vkggfd57nb9eLSK7Pb_fbuycGTJZM=+6=4VZo3F0w@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12273.1406195935.18130.python-list@python.org> (permalink)

Show all headers | View raw


Martin S <shieldfire@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: one to many (passing variables) Ben Finney <ben+python@benfinney.id.au> - 2014-07-24 19:58 +1000

csiph-web