From: W. Trevor King Date: Sun, 16 May 2010 12:21:20 +0000 (-0400) Subject: Add hooke.playlist.NoteIndexList.__str__() method. X-Git-Url: http://git.tremily.us/?p=hooke.git;a=commitdiff_plain;h=0a4125c1730a5ae595ce13650178cd15e4571e80 Add hooke.playlist.NoteIndexList.__str__() method. Now playlists etc. will flatten themselves to strings with: '...%s...' % instance. --- diff --git a/hooke/playlist.py b/hooke/playlist.py index fc4ea9a..4cc897a 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -42,6 +42,9 @@ class NoteIndexList (list): self.info = {} self._index = 0 + def __str__(self): + return '<%s %s>' % (self.__class__.__name__, self.name) + def current(self): if len(self) == 0: return None diff --git a/test/load_playlist.py b/test/load_playlist.py index c944709..46af92e 100644 --- a/test/load_playlist.py +++ b/test/load_playlist.py @@ -20,7 +20,7 @@ >>> from hooke.hooke import Hooke >>> h = Hooke() >>> h.run_lines(['load_playlist test/data/test']) # doctest: +ELLIPSIS -[] + Success """