[Python-Dev] PEP needed? Introducing Tcl objects (original) (raw)
Martin v. Loewis martin@v.loewis.de
15 Feb 2002 21:13:43 +0100
- Previous message: [Python-Dev] PEP needed? Introducing Tcl objects
- Next message: [Python-Dev] PEP needed? Introducing Tcl objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"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
- Previous message: [Python-Dev] PEP needed? Introducing Tcl objects
- Next message: [Python-Dev] PEP needed? Introducing Tcl objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]