[Tutor] Division

Tim Peters tim.one@home.com
Thu, 6 Dec 2001 01:25:24 -0500


About -Qnew, it turns out Guido ran into a snag when implementing it, so it
didn't work like PEP 238 said it would work.  Instead it worked the way the
NEWS file said:

   Using -Qnew is questionable; it turns on new division by default, but
   only in the __main__ module.  You can usefully combine -Qwarn
   or -Qwarnall and -Qnew: this gives the __main__ module new division,
   and warns about classic division everywhere else.

As you discovered (thanks for reminding us!), that was questionable indeed.
I've repaired this now:  -Qnew will work as documented by the PEP in 2.2c1
(release candidate 1, due out late next week).

After doing

    pythonw -Qnew tools\idle\idle.pyw

from your 2.2c1 directory, this is what you'll get:

Python 2.2c1 (#26, Dec  6 2001, 00:20:15) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> 1/2
0.5
>>>

Please note the other warnings about -Qnew in the PEP, in particular that it
turns *all* instances of "/" into true division, including those in
3rd-party modules that may not yet be expecting true division.  If you use
true division before it's the default, you're a pioneer, and should expect
bears to try to eat you <wink>.