Description | Download | Acknowledgements
The trivrepr module contains the TrivialRepr class that may be derived
from to provide an implementation of
__repr__() for simple
classes that have all their attributes passed directly to the constructor.
import trivrepr class KeyValue(trivrepr.TrivialRepr): def __init__(self, key, value, more='hi'): super(KeyValue, self).__init__() self.key = key self.value = value self.more = more kv = KeyValue(key='key', value='val') print(repr(kv))
This program will output:
KeyValue(key='key', value='val', more='hi')
The trivrepr homepage is here; the development history may be seen in the change log.
The latest release is trivrepr-0.1.1:
Thanks go to (in no particular order):
Description | Download | AcknowledgementsContacts: Peter Pentchev