Skip to content

Instantly share code, notes, and snippets.

View TomFaulkner's full-sized avatar
:octocat:
GitHub activity feed is almost as exciting as early Twitter.

Tom Faulkner TomFaulkner

:octocat:
GitHub activity feed is almost as exciting as early Twitter.
View GitHub Profile
@TomFaulkner
TomFaulkner / filtering.py
Last active July 15, 2017 23:12
Include and exclude filter for exact matches or regex matches
"""
Function to filter a string using an optional exact match whitelist (include),
optional whitelist using regex (include_regex),
exact match blacklist (exclude), and blacklist regex (exclude_regex)
See unittest below for usage examples
Code is from https://github.com/TomFaulkner/pypihole/blob/master/pypihole/helpers/filtering.py,
check there for updates
"""
@TomFaulkner
TomFaulkner / beautiful_idiomatic_python.md
Created April 26, 2017 05:09 — forked from mongoose11235813/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: