Skip to content

Instantly share code, notes, and snippets.

View andrewtremblay's full-sized avatar
🕵️‍♂️
Working on secret stuff.

Andrew Tremblay andrewtremblay

🕵️‍♂️
Working on secret stuff.
View GitHub Profile
@spitz-dan-l
spitz-dan-l / multiple_dispatch.py
Last active June 8, 2017 14:34
Advanced python multiple dispatch implementation very advanced
import random #definitely a good thing to see at the top of a multiple-dispatch implementation!
import abc
import itertools
class ArgValidator:
@classmethod
def validate(cls, *args, mro_distances=None):
if mro_distances is None:
mro_distances = []
#disqualify validation rules with the wrong number of arguments