Skip to content

Instantly share code, notes, and snippets.

View acatton's full-sized avatar

Antoine Catton acatton

View GitHub Profile
@acatton
acatton / class_and_instance_method.py
Last active August 29, 2015 14:10
Have a method behaving differently depending wether it was called on the instance or the class itself
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Antoine Catton. Licensed under WTFPL <http://www.wtfpl.net/>
# Thank you Gavin Wahl for the idea.
import functools
class class_and_instance_method(object):
"""