diff options
author | Guido van Rossum <guido@python.org> | 2007-06-07 23:15:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-07 23:15:56 (GMT) |
commit | 1325790b932c4bab4f8f94f5a36c09f4036ed9f8 (patch) | |
tree | 5f4c1d854783a4d082c5867094ec345f4772bf35 /Lib/lib-tk | |
parent | 7b955bd125951db694f19a1b8648b806b14bd61f (diff) | |
download | cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.zip cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.gz cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.bz2 |
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines
Get rid of some remnants of classic classes. types.ClassType == type.
Also get rid of almost all uses of the types module and use the builtin name.
........
r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line
Remove a use of types, verify commit hook works
........
r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines
Fix syntax error introduced by Neal in last checkin.
........
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/ScrolledText.py | 2 | ||||
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/Lib/lib-tk/ScrolledText.py b/Lib/lib-tk/ScrolledText.py index 367aa89..19ad6dd 100644 --- a/Lib/lib-tk/ScrolledText.py +++ b/Lib/lib-tk/ScrolledText.py @@ -21,7 +21,7 @@ class ScrolledText(Text): cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): - if type(k) == ClassType or k == 'name': + if isinstace(k, type) or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = Frame(master, **fcnf) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 5a73ca8..6b360fe 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -38,7 +38,6 @@ if sys.platform == "win32": import _tkinter # If this fails your Python may not be configured for Tk tkinter = _tkinter # b/w compat for export TclError = _tkinter.TclError -from types import * from Tkconstants import * try: import MacOS; _MacOS = MacOS; del MacOS @@ -61,11 +60,11 @@ try: _tkinter.deletefilehandler except AttributeError: _tkinter.deletefilehandler = None -def _flatten(tuple): +def _flatten(seq): """Internal function.""" res = () - for item in tuple: - if type(item) in (TupleType, ListType): + for item in seq: + if isinstance(item, (tuple, list)): res = res + _flatten(item) elif item is not None: res = res + (item,) @@ -76,9 +75,9 @@ except AttributeError: pass def _cnfmerge(cnfs): """Internal function.""" - if type(cnfs) is DictionaryType: + if isinstance(cnfs, dict): return cnfs - elif type(cnfs) in (NoneType, StringType): + elif isinstance(cnfs, (type(None), str)): return cnfs else: cnf = {} @@ -867,7 +866,7 @@ class Misc: data = self.tk.split( self.tk.call('winfo', 'visualsavailable', self._w, includeids and 'includeids' or None)) - if type(data) is StringType: + if isinstance(data, str): data = [self.tk.split(data)] return map(self.__winfo_parseitem, data) def __winfo_parseitem(self, t): @@ -934,7 +933,7 @@ class Misc: self.tk.call('bindtags', self._w, tagList) def _bind(self, what, sequence, func, add, needcleanup=1): """Internal function.""" - if type(func) is StringType: + if isinstance(func, str): self.tk.call(what + (sequence, func)) elif func: funcid = self._register(func, self._substitute, @@ -1181,7 +1180,7 @@ class Misc: self.tk.call(_flatten((self._w, cmd)))): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf - if type(cnf) is StringType: + if isinstance(cnf, str): x = self.tk.split( self.tk.call(_flatten((self._w, cmd, '-'+cnf)))) return (x[0][1:],) + x[1:] @@ -1262,7 +1261,7 @@ class Misc: bbox = grid_bbox def _grid_configure(self, command, index, cnf, kw): """Internal function.""" - if type(cnf) is StringType and not kw: + if isinstance(cnf, str) and not kw: if cnf[-1:] == '_': cnf = cnf[:-1] if cnf[:1] != '-': @@ -1923,7 +1922,7 @@ class BaseWidget(Misc): BaseWidget._setup(self, master, cnf) classes = [] for k in cnf.keys(): - if type(k) is ClassType: + if isinstance(k, type): classes.append((k, cnf[k])) del cnf[k] self.tk.call( @@ -2136,7 +2135,7 @@ class Canvas(Widget): """Internal function.""" args = _flatten(args) cnf = args[-1] - if type(cnf) in (DictionaryType, TupleType): + if isinstance(cnf, (dict, tuple)): args = args[:-1] else: cnf = {} @@ -3695,7 +3694,7 @@ class PanedWindow(Widget): 'paneconfigure', tagOrId)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf - if type(cnf) == StringType and not kw: + if isinstance(cnf, str) and not kw: x = self.tk.split(self.tk.call( self._w, 'paneconfigure', tagOrId, '-'+cnf)) return (x[0][1:],) + x[1:] |