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


Groups > comp.lang.python > #100485

Re: Help on code comprehension from an example project of pymc

From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Help on code comprehension from an example project of pymc
Date 2015-12-15 17:45 -0500
Message-ID <mailman.44.1450219519.22044.python-list@python.org> (permalink)
References <5e772de2-e50f-48f1-988c-a7c3eff33b10@googlegroups.com>

Show all headers | View raw


On 12/15/2015 11:15 AM, Robert wrote:
> Hi,
>
> I find the useful small code project for me:
> #https://users.obs.carnegiescience.edu/cburns/ipynbs/PyMC.html
>
> It runs as expected.
>
> When I review the code, I find 'data' in the original line:
>
> data = pymc.Normal('data', mu=model, tau=tau, value=z_obs, observed=True)
>
> has not been referenced thereafter.

If the function is called strictly for its side-effect, then it would be 
normal to not keep the 'return' value.  Code checkers will catch this 
and warn.  Just because code is make available, does not mean it follows 
the best style.  Perhaps the programmer though 'data' might be needed 
before writing the rest.

> If I comment out the line as:
>
> #data = pymc.Normal('data', mu=model, tau=tau, value=z_obs, observed=True)
>
> the result is ugly different from the original.
>
> If I change it to:
>
> pymc.Normal('data', mu=model, tau=tau, value=z_obs, observed=True)
>
> it still runs as the original.



-- 
Terry Jan Reedy

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


Thread

Help on code comprehension from an example project of pymc Robert <rxjwg98@gmail.com> - 2015-12-15 08:15 -0800
  Re: Help on code comprehension from an example project of pymc Chris Angelico <rosuav@gmail.com> - 2015-12-16 09:34 +1100
  Re: Help on code comprehension from an example project of pymc Terry Reedy <tjreedy@udel.edu> - 2015-12-15 17:45 -0500

csiph-web