diff nes.py @ 118:72c36fb13706 draft

Tile: replace __repr__ method Seeing a view of the whole tile is a bit noisy when the tiles are inside a list. Let's make that full view its __str__ instead and introduce a more minimal view for the repr instead.
author Jordi GutiƩrrez Hermoso <jordigh@octave.org>
date Mon, 30 Sep 2019 09:18:19 -0400 (2019-09-30)
parents fbb04916a5a7
children 9c97adbb349c
line wrap: on
line diff
--- a/nes.py
+++ b/nes.py
@@ -97,6 +97,9 @@
         self.set_palette(self.default_palette.copy())
 
     def __repr__(self):
+        return f"Tile(bytes={self.raw_tile}, palette={self.palette})"
+
+    def __str__(self):
         num_to_ascii = {0: " ", 1: ".", 2: "o", 3: "#"}
         return "_"*10 + "\n" + "\n".join(
             "[" + "".join([num_to_ascii[val] for val in row]) + "]"