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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2

File details

Details for the file gen-repr-0.2.0.tar.gz.

File metadata

  • Download URL: gen-repr-0.2.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

File hashes

Hashes for gen-repr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dd2206cc62a15e7522c0fcded6d3abcd5f1598f3b3c49dcfe01160584d4c4e96
MD5 2ca9cf7987c303308bcfe41c0dad603b
BLAKE2b-256 c60f5bad08ed391686e5eac91d8e67910fbf00c3aa85edfc4aab3a07d862e3d0

See more details on using hashes here.

File details

Details for the file gen_repr-0.2.0-py2-none-any.whl.

File metadata

  • Download URL: gen_repr-0.2.0-py2-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

File hashes

Hashes for gen_repr-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 2d4a781bf53719d86a1ad9690432a504dabca40fe9f8b7e4b87628f4b90f48c0
MD5 4bab529525cff4b93b590e5776322b66
BLAKE2b-256 ad5172b860326880428a4a014d3a869b1952486c742600469ff447f7ff0f2cd1

See more details on using hashes here.

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