Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update programming.rst #2768

Closed
wants to merge 1 commit into from
Closed

Update programming.rst #2768

wants to merge 1 commit into from

Conversation

kgashok
Copy link

@kgashok kgashok commented Jul 19, 2017

missing negative sign added.

@marco-buttu
Copy link
Contributor

Hi @kgashok, could you please open an issue on http://bugs.python.org/, as described in the devguide? I am not sure this is a documentation bug, because IMHO it is not clear what the example wants to emphasize. I am not a native English speaker, but the first sentence of the section seems wrong to me. We will discuss it in http://bugs.python.org/

@@ -803,7 +803,7 @@ the same sign as ``i``.
There are few real use cases for ``i % j`` when ``j`` is negative. When ``j``
is positive, there are many, and in virtually all of them it's more useful for
``i % j`` to be ``>= 0``. If the clock says 10 now, what did it say 200 hours
ago? ``-190 % 12 == 2`` is useful; ``-190 % 12 == -10`` is a bug waiting to
ago? ``-190 % 12 == 2`` is useful; ``-190 % -12 == -10`` is a bug waiting to
bite.
Copy link
Member

@terryjreedy terryjreedy Jul 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trivial correction is wrong, and it misses the point of the 'False' equality. If -190 % 12 were -10 instead of 2, it would be less useful and possibly lead to bugs.

@terryjreedy
Copy link
Member

terryjreedy commented Jul 24, 2017

I opened bpo-31021 to propose a correct change to what is a confusing hypothetical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants