Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.059 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; '2004': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:blog': 0.10; 'api': 0.11; 'martin': 0.11; 'python': 0.11; 'apis.': 0.16; 'code?': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'header:User-Agent:1': 0.23; 'decide': 0.24; 'question': 0.24; 'asking': 0.27; 'header:X -Complaints-To:1': 0.27; 'properties': 0.29; 'url:05': 0.31; 'writes:': 0.31; 'sense': 0.34; 'subject: (': 0.35; 'subject:one': 0.36; 'too': 0.37; 'requirements': 0.37; 'arrange': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'ensure': 0.60; 'even': 0.60; 'matter': 0.61; 'skip:* 10': 0.61; 'such': 0.63; 'refer': 0.63; 'more': 0.64; 'needing': 0.65; 'here': 0.66; 'natural': 0.68; 'improvements': 0.68; '8bit%:21': 0.69; 'article': 0.77; 'received:125': 0.84; 'url:2007': 0.84; 'faith': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: one to many (passing variables) Date: Thu, 24 Jul 2014 19:58:31 +1000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:17QsOA8gGweHGvoMmC6EKq6D8kM= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406195935 news.xs4all.nl 2830 [2001:888:2000:d::a6]:56827 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75135 Martin S 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 . 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