# HG changeset patch # User Radek Brich # Date 1313608307 -7200 # Node ID ec1d47e6fe09f20a1d99224e7c02df914dd132f3 # Parent 7175ed629a76e3a9b5bbe8025851d2f35ff14f51 Use isinstance instead of type. diff -r 7175ed629a76 -r ec1d47e6fe09 tuikit/backend_curses.py --- a/tuikit/backend_curses.py Sun Jul 31 13:04:39 2011 +0200 +++ b/tuikit/backend_curses.py Wed Aug 17 21:11:47 2011 +0200 @@ -252,7 +252,7 @@ if not self.testclip(x, y): return try: - if type(c) is str and len(c) == 1: + if isinstance(c, str) and len(c) == 1: self.screen.addstr(y, x, c) else: self.screen.addch(y, x, c) @@ -267,7 +267,7 @@ def hline(self, x, y, w, c=' '): - if type(c) is str: + if isinstance(c, str): s = c*w else: s = [c]*w diff -r 7175ed629a76 -r ec1d47e6fe09 tuikit/editfield.py --- a/tuikit/editfield.py Sun Jul 31 13:04:39 2011 +0200 +++ b/tuikit/editfield.py Wed Aug 17 21:11:47 2011 +0200 @@ -10,7 +10,7 @@ Widget.__init__(self, width, 1) self.code = locale.getpreferredencoding() - if not type(value) is str: + if not isinstance(value, str): value = str(value, self.code) self.value = value diff -r 7175ed629a76 -r ec1d47e6fe09 tuikit/menu.py --- a/tuikit/menu.py Sun Jul 31 13:04:39 2011 +0200 +++ b/tuikit/menu.py Wed Aug 17 21:11:47 2011 +0200 @@ -98,7 +98,7 @@ def run_selected(self): if self.selected and self.selected[1] is not None: - if type(self.selected[1]) is str: + if isinstance(self.selected[1], str): self.emit('activate', self.selected[1]) elif isinstance(self.selected[1], Widget): self.selected[1].show()