From e94aa6bf50b640b38829d850a0c911e752ccb998 Mon Sep 17 00:00:00 2001
From: peterjc
Date: Fri, 21 Sep 2018 12:42:35 +0100
Subject: [PATCH] Define repr(_Record) using existing str method.
The existing __str__ method defines what is superficially
a Python snippet which could recreate the object - and
captures the key attributes.
This follows the style elsewhere in this file of using
the same output for __str__ and __repr__ methods.
---
vcf/model.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/vcf/model.py b/vcf/model.py
index 34a4d17..9ba75e2 100644
--- a/vcf/model.py
+++ b/vcf/model.py
@@ -272,6 +272,9 @@ def __iter__(self):
def __str__(self):
return "Record(CHROM=%(CHROM)s, POS=%(POS)s, REF=%(REF)s, ALT=%(ALT)s)" % self.__dict__
+ def __repr__(self):
+ return str(self)
+
def add_format(self, fmt):
self.FORMAT = self.FORMAT + ':' + fmt