[wxPython-users] Re: wx.Timer accurate?
Christopher Barker
Chris.Barker at noaa.gov
Thu Jul 27 12:10:49 PDT 2006
John Salerno wrote:
> But even
> if I remove the parentheses, wouldn't that still be a problem?
That depends on what type self.minutesPassed is -- if it's a Float, the
everything else will get upcasted.
>> self.progress.SetValue(self.minutesPassed * (100 / self.time))
better yet, use:
from __future__ import division
>>> 100 / 60
1
>>> from __future__ import division
>>> 100 / 60
1.6666666666666667
>>>
>>> 100 // 60
1
This has been there for a LONG time, but I guess it won't be until Py3k
until it becomes standard. too bad. While painted as a crutch for
newbies, even those of us that know the issues get bitten too. implied
integer division just doesn't make sense with a dynamic language.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list