Mark Summerfield | 24 Jun 2012 09:42

BooleanVar() etc.

Hi,

Right now it is possible to do

    bv = BooleanVar()
    bv.set(any_old_rubbish)
    b = bv.get() # b is an int not a bool

I've reported this as a bug and commented that I think that BooleanVar,
IntVar, FloatVar, and StringVar should honor the type in their names
(i.e., bool, int, float, str).

If this matters to you could you look at the issue and maybe comment?

http://bugs.python.org/issue15133

--

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Go" - ISBN 0321774639
            http://www.qtrac.eu/gobook.html
Michael Lange | 24 Jun 2012 19:44
Picon

Re: BooleanVar() etc.

Hi Mark,

Thus spoketh Mark Summerfield <list <at> qtrac.plus.com> 
unto us on Sun, 24 Jun 2012 08:42:33 +0100:

> Hi,
> 
> Right now it is possible to do
> 
>     bv = BooleanVar()
>     bv.set(any_old_rubbish)
>     b = bv.get() # b is an int not a bool
> 
> I've reported this as a bug and commented that I think that BooleanVar,
> IntVar, FloatVar, and StringVar should honor the type in their names
> (i.e., bool, int, float, str).
> 
> If this matters to you could you look at the issue and maybe comment?
> 
> http://bugs.python.org/issue15133

I've been there and spent my 2 cents ;)
Now I just wanted to leave a comment here, too.
First, the return value of get() is not neccessarily an int:

>>> b = BooleanVar()
>>> b.set('yes')
>>> b.get()
True
>>> b.set('1')
(Continue reading)


Gmane