A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
# Public Domain, i.e. feel free to copy/paste | |
# Considered a hack in Python 2 | |
import inspect | |
def caller_name(skip=2): | |
"""Get a name of a caller in the format module.class.method | |
`skip` specifies how many levels of stack to skip while getting caller | |
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc. |
#!/usr/bin/env python | |
import csv | |
from math import cos, pi | |
# API key for Google Places | |
api_key= 'YOUR_KEY_GOES_HERE' | |
outf = open('njpoints.csv','w') | |
w = csv.writer(outf) |
import os | |
import sys | |
from xml.sax import parse | |
from xml.sax.saxutils import XMLGenerator | |
class CycleFile(object): | |
def __init__(self, filename): | |
self.basename, self.ext = os.path.splitext(filename) | |
self.index = 0 |
#!/usr/bin/env python | |
__author__ = 'Kevin Warrick' | |
__email__ = '[email protected], [email protected]' | |
__version__ = '2.0.0' | |
import pickle | |
from collections import namedtuple | |
from functools import wraps | |
import inspect | |
from icecream import ic |