"Fredrik Lundh" <fredrik@pythonware.com> writes: > > For backward compatibility, there is an option on the tkapp object to > > determine whether strings or objects are returned. This is on by > > default when using Tkinter > > "on" as in "return strings" or "return objects" ? In Tkinter, it returns objects by default. > I doubt it's a good idea to change the return type without any > warning. This is not as bad as it sounds. For most functions, the return type does not change at all. Consider def winfo_depth(self): """Return the number of bits per pixel.""" return getint(self.tk.call('winfo', 'depth', self._w)) 'winfo depth' will return a Tcl int in Tcl, which is currently converted to a string in _tkinter, then converted back to an int. With the change, tk.call will already return an int, so the getint invocation becomes a no-op. For others, a conversion into string will continue to return the value that it currently returns: >>> l=Tkinter.Label() >>> l.config("foreground")[3] <color object at 0x0824b4b0> >>> str(_) 'Black' I would expect that few if any applications will be affected; those would need to change the default after import Tkinter. > if the default is "use old behaviour", check it in. > > if you insist on changing the return types, post it to SF. I'd like to change the return types. If that is not acceptable, I'd like to produce a DeprecationWarning if Tkinter is imported and the new-style behaviour (return objects) is not enabled. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4