Skip to content

Instantly share code, notes, and snippets.

View jkugler's full-sized avatar

Joshua Kugler jkugler

View GitHub Profile
@ubershmekel
ubershmekel / generic_repr.py
Created October 27, 2015 17:32
Simple repr methods that allow you to reconstruct a simple object
"""
These two repr implementations make a "repr" that you can just drop into your class if it's a simple one.
"""
class A:
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "%s(**%r)" % (self.__class__.__name__, self.__dict__)