Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fdde79d

Browse files
committed
Fix the clarification as to why division cannot be ported automatically
1 parent c332f8a commit fdde79d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/howto/pyporting.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ things:
169169
division or continue using ``/`` and expect a float
170170

171171
The reason that ``/`` isn't simply translated to ``//`` automatically is that if
172-
an object defines its own ``__div__`` method but not ``__floordiv__`` then your
173-
code would begin to fail.
172+
an object defines a ``__truediv__`` method but not ``__floordiv__`` then your
173+
code would begin to fail (e.g. a user-defined class that uses ``/`` to
174+
signify some operation but not ``//`` for the same thing or at all).
174175

175176
Text versus binary data
176177
+++++++++++++++++++++++

0 commit comments

Comments
 (0)