Refactoring thread

Fair warning: this code is not intended to run just yet. As I was refactoring the functions I realized I had questions for Dan and Co. and decided to put them up on github in order to avoid another long email thread. I'll try to tag people in specific comments to make those salient to relevant folks.


On Wed, 10 Sep 2014, Ilia Kurenkov wrote:

> 
> In translation.py:
> 
> > +    # x02900 = c02900  # IK: for now leaving out
> > +
> > +    return cd
> > +
> > +
> > +def CapGains(cd):
> > +    #Capital Gains
> > + 
> > +    cd['c23650'] = puf_dict['c23250'] + puf_dict['e22250'] + puf_dict['e23660'] 
> > +    cd['c01000'] = np.maximum(-3000/ cd['sep'], cd['c23650'])
> > +    # feimax = maximum foreign earned income exclusion
> > +    # this variable is problematic: in the SAS code it's defined as an array
> > +    # that has 20 members, covering the period of 1993-2013
> > +    # In our current PlanX, however, it's just a one-member array, having
> > +    # only retained the last feimax value from before
> > +    mod_feimax = planX['feimax'][2013-puf_dict['FLPDYR']] * puf_dict['f2555']
> 
> Declaring and modifying global variables is highly discouraged in python (see this,
> the section on Global variables here). It also leads to minor slowdowns. What I'm
> doing is passing a reference to a dictionary to each function and creating keys in
> this dictionary for our variables. We could alternatively define a class for this
> dictionary and set its attributes/properties, but I'm trying to keep this as
> mechanically simple as possible to avoid slowdowns.

This seems to be a strong argument against using numpy, or Python. We 
didn't see this in the sample programs written at Claremont, though.

I don't understand the need for dictionaries, classes and objects. All are 
values are perfectly represented as integers or reals, and we never need 
to define any operators - the traditional operators are all we need.

This is getting out of hand quickly.

dan
> 
> —
> Reply to this email directly or view it onGitHub.[8114261__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyNjAyMzk4MywiZ
> GF0YSI6eyJpZCI6NDE2Mjg2NDl9fQ==--82b65e75e37a1c4fea695731890e6f2da235e96d.gif]
> 
> 
>