Future division patch available (PEP 238)

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Jul 23 06:52:33 EDT 2001


Steve Horne <sh at ttsoftware.co.uk> writes:

> Yes, but what about my existing algorithm in some code somewhere that
> uses n / 2 to partition an array and checks for == 0 as the
> termination condition. It's not exactly going to work very well after
> the change, is it.

No, that is what the transition procedure to support the language
change must solve. One possible procedure would be

1. In 2.2, your algorithm continues to work unless you put some future
   import into it.

2. In 2.3, your algorithm continues to work, but produces a warning
   the first time integer division is used with the '/'; you could
   shut off the warning by either adding a future import, or using
   '//' division.

3. In 2.4, your algorithm will not exactly work very well.

> But the existing use of division in many applications is going to
> suddenly work differently, leading to all kinds of strange
> hard-to-trace bugs, and Pythons advocates are going to end up looking
> *very* stupid indeed.

No, that won't be a sudden change.

Regards,
Martin



More information about the Python-list mailing list