From b625efee35009ec66e13c5f54dd3b70b77f803d1 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 10 Oct 2007 16:34:11 -0300 Subject: [PATCH] Add default conversion from Sequence to str and unicode. --- pymin/seqtools.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pymin/seqtools.py b/pymin/seqtools.py index d3de929..4a6338a 100644 --- a/pymin/seqtools.py +++ b/pymin/seqtools.py @@ -39,8 +39,14 @@ class Sequence: r"obj[i] -> object :: Get item with the index i." return self.as_tuple()[i] + def __unicode__(self): + return u'%s%r' % (self.__class__.__name__, self.as_tuple()) + + def __str__(self): + return unicode(self).encode('utf-8') + def __repr__(self): - return '%s%r' % (self.__class__.__name__, self.as_tuple()) + return str(self) def as_tuple(obj): r"""as_tuple(obj) -> tuple :: Convert objects to tuple. -- 2.43.0