Skip to content

Instantly share code, notes, and snippets.

'''A few notes before we begin
I'll separate my notes into three types, docstrings like this, whole line comments, and
inline comments. Docstrings will discuss the ideas behind the objects. What's the intent,
and what programming concepts do they present that are worth discussing. Full line comments
will discuss the details of the implementation. What the code is doing and why. Inline
comments will comprise a small portion of my notes, and are mostly to point out examples
mentioned in the rest of my notes, or return values. Another convention that I use is
backticks, which will be used to refer to an actual object in the code. If I say the word
one, it's just a word, but `one` is a reference to some object in code.
@sloria
sloria / bobp-python.md
Last active June 18, 2024 08:18
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
import numpy as np
def cartesian(arrays, out=None):
"""
Generate a cartesian product of input arrays.
Parameters
----------
arrays : list of array-like
1-D arrays to form the cartesian product of.