Terry J. Reedy <tjre...@udel.edu> added the comment:

Mark: "Variable.get(self) returns self._tk.globalgetvar(self._name). 
String/Int/Double/Var call str/int/float as appropriate." was meant to say that 
String/Int/Double/Var.get(self) already call str/int/float on the result of 
self._tk.globalgetvar(self._name) before returning it. BooleanVar.get does not 
call bool, but instead calls self._tk.getboolean, which fails to always return 
a boolean.

Klappnase: I disagree, somehow. bool is a subclass of int, so that False, True 
are arithmetically indistinguishable from 0, 1. The main difference is on 
display and 'type(x) = int/bool' comparisons (which should be isinstance()). 
BooleanVar.get already returns False, True for the tcl boolean values '0', '1' 
set by tk rather than the user (which I expect should be the usual case for 
retrieval). So a Python/tkinter program has to be prepared to get proper 
booleans anyway. Since the purpose of Variables is to synchronize values 
between user code and tk, TypeVar().set(x).get() should be x when has the 
proper type. That is now true for everything but bool/Boolean.

I do wonder whether not converting or rejecting bad inputs to .set could cause 
problems with tk, but maybe some of that is handled later (and silently? if so 
bad) within _tkinter. I could be persuaded that a behavior fix should only be 
applied to 3.3.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15133>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to