a *= b not equivalent to a = a*b

mlz mlzarathustra at gmail.com
Fri Aug 26 06:03:18 EDT 2016


Aha. That's interesting.
On Friday, August 26, 2016 at 2:11:32 AM UTC-7, Peter Otten wrote:
> mlz wrote:
>> > Yes, I just worked that out. It's the integer math that's the problem.
> > 
> > I guess this has been fixed in python 3, but unfortunately it seems that
> > most people are still using python 2.
>> Note that you can get Python 3's default behaviour in Python 2 with
>> from __future__ import division
>> at the beginning of the module.
>> >>> 2/3
> 0
> >>> from __future__ import division
> >>> 2/3
> 0.6666666666666666



More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /