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


Groups > comp.lang.python > #59554

Re: understanding someone else's program

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: understanding someone else's program
Date 2013-11-15 17:41 +0000
Organization A noiseless patient Spider
Message-ID <l65mc2$769$3@dont-email.me> (permalink)
References <19cb1c85-1c01-4c53-a26a-29f96c5926eb@googlegroups.com>

Show all headers | View raw


On Fri, 15 Nov 2013 03:05:04 -0800, C. Ng wrote:

> Hi all,
> 
> Please suggest how I can understand someone else's program where -
> documentation is sparse - in function A, there will be calls to function
> B, C, D.... and in those functions will be calls to functions R,S,T....
> and so on so forth... making it difficult to trace what happens to a
> certain variable
> 
> Am using ERIC4 IDE.

You just have to work through it working out what each line does.

Start with the inputs and give them sensible names, after all you 
presumably know where they come from and what they represent. Then you 
can see what operations are being performed on the input data, and 
presumably if you have enough knowledge in any relevant fields, may be 
able to determine that, for example, when the input 'x' is actually a 
temp in fahrenheit, then the math operation 'x=(x-32)*5/9' is really 
"convert temp from fahrenheit to centigrade".

As you do this add relevant comments to the code. Eventually you'll have 
code with sensible variable names and comments that hopefully describe 
what it does.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


Thread

understanding someone else's program "C. Ng" <ngcbmy@gmail.com> - 2013-11-15 03:05 -0800
  Re: understanding someone else's program Ben Finney <ben+python@benfinney.id.au> - 2013-11-15 22:19 +1100
  Re: understanding someone else's program Joel Goldstick <joel.goldstick@gmail.com> - 2013-11-15 08:39 -0500
  Re: understanding someone else's program William Ray Wing <wrw@mac.com> - 2013-11-15 08:50 -0500
  Re: understanding someone else's program Chris Angelico <rosuav@gmail.com> - 2013-11-16 01:03 +1100
  Re: understanding someone else's program Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-15 17:41 +0000
  Re: understanding someone else's program Laurent Pointal <laurent.pointal@free.fr> - 2013-11-18 23:42 +0100

csiph-web