<commit_before>Style Guide & Best Practices
============================

Style Guide
-----------

Anything Raymond Hettinger says wins the argument until I have time to write a
proper style guide.

Best Practices
--------------

* It is recommended to always use named models. So not::

    model = a * x**2
    fit = Fit(model, xdata, ydata)

  but::

    model = {y: a * x**2}
    fit = Fit(model, x=xdata, y=ydata)

  In this simple example the two are equivalent but for multidimentional data
  using ordered arguments can become ambiguous and it even appears there is a
  difference in interpretation between py2 and py3. To prevent such ambiguity
  and to make sure your code is transportable, always use named models. And the
  result is more readable anyway right?

* When evaluating models use tuple-unpacking::

    model = {y_1: x**2, y_2: x**3}
    sol_1, sol_2 = model(x=xdata)

  and not::

    sol_1 = model(x=xdata)[0]

  or something similar.<commit_msg>Improved style guide, particularly on accessing vector valued functions<commit_after>Style Guide & Best Practices
============================

Style Guide
-----------

Anything Raymond Hettinger says wins the argument until I have time to write a
proper style guide.

Best Practices
--------------

* It is recommended to always use named models. So not::

    model = a * x**2
    fit = Fit(model, xdata, ydata)

  but::

    model = {y: a * x**2}
    fit = Fit(model, x=xdata, y=ydata)

  In this simple example the two are equivalent but for multidimentional data
  using ordered arguments can become ambiguous and it even appears there is a
  difference in interpretation between py2 and py3. To prevent such ambiguity
  and to make sure your code is transportable, always use named models. And the
  result is more readable anyway, right?

* When evaluating models use the variable names::

    model = {y_1: x**2, y_2: x**3}
    solutions = model(x=xdata)
    sol_1 = solutions.y_1
    sol_2 = solutions.y_2

  Normal tuple unpacking is also acceptable::

    sol_1, sol_2 = model(x=xdata)

  Using numerical indexing (or something similar) is not recommended::

    sol_1 = model(x=xdata)[0]

{'fraction_non_alphanumeric': 0.1151012891344383, 'fraction_numerical': 0.01289134438305709, 'mean_word_length': 3.3286852589641436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1834793', 'n_tokens_mistral': 651, 'n_tokens_neox': 612, 'n_words': 279}