Skip to content

Instantly share code, notes, and snippets.

View jomido's full-sized avatar
🎯
Focusing

Jonathan Dobson jomido

🎯
Focusing
View GitHub Profile
@jomido
jomido / fizzbuzz.py
Last active December 16, 2015 19:59
General Fizzbuzz III
def n_of_k(n, k):
return lambda n: n % k == 0
def n_for_ks(n, *ks):
return [n_of_k(n, k) for k in ks]
@jomido
jomido / fizzbuzz.py
Last active December 16, 2015 19:30
General Fizzbuzz II
def n_of_k(n, k):
return lambda n: n % k == 0
def n_for_ks(n, *ks):
return [n_of_k(n, k) for k in ks]
@jomido
jomido / pyTypeConstrain.py
Last active October 8, 2015 00:10
Python Type Constraints (with Reserved Attributes)
class SchemaFailException(Exception):
def __init__(self, message, attr, valid_types):
Exception.__init__(self, message)
self.attr = attr
self.valid_types = valid_types