Skip to main content

Automatically generate the repr of a class with all it's fields

Project description

gen-repr Build Status

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


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)

Uploaded Source

Built Distribution

gen_repr-0.2.0-py2-none-any.whl (3.9 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page