Automatically generate the repr of a class with all it's fields
Project description
gen-repr
Lightweight python library without any dependencies to automatically generate
the __repr__
method for any class.
Getting started
Install this package throught pip
$ pip install gen-repr
After that you can import it in your program like this
from genrepr import gen_repr
Example
from genrepr import gen_repr
@gen_repr()
class Person(object):
def __init__(self):
self.first_name = u""
self.age = 0
self._hair = u"any color you like"
peter = Person()
peter.first_name = u"Peter"
peter.age = -1
repr(peter) # result: "<Person (first_name='Peter', age=-1)>:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gen-repr-0.2.0.tar.gz
(2.9 kB
view hashes)