Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2d71822f
Commit
2d71822f
authored
Nov 21, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a few updates to the gloassary with regards to __future__ and division
parent
58425d31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
27 deletions
+12
-27
Doc/glossary.rst
Doc/glossary.rst
+12
-27
No files found.
Doc/glossary.rst
View file @
2d71822f
...
...
@@ -74,10 +74,7 @@ Glossary
``int(3.15)`` converts the floating point number to the integer ``3``, but
in ``3+4.5``, each argument is of a different type (one int, one float),
and both must be converted to the same type before they can be added or it
will raise a ``TypeError``. Coercion between two operands can be
performed with the ``coerce`` builtin function; thus, ``3+4.5`` is
equivalent to calling ``operator.add(*coerce(3, 4.5))`` and results in
``operator.add(3.0, 4.5)``. Without coercion, all arguments of even
will raise a ``TypeError``. Without coercion, all arguments of even
compatible types would have to be normalized to the same value by the
programmer, e.g., ``float(3)+4.5`` rather than just ``3+4.5``.
...
...
@@ -180,6 +177,11 @@ Glossary
A module written in C or C++, using Python's C API to interact with the core and
with user code.
floor division
Mathematical division discarding any remainder. The floor division
operator is ``//``. For example, the expression ``11//4`` evaluates to
``2`` in contrast to the ``2.75`` returned by float true division.
function
A series of statements which returns some value to a caller. It can also
be passed zero or more arguments which may be used in the execution of
...
...
@@ -187,16 +189,11 @@ Glossary
__future__
A pseudo module which programmers can use to enable new language features
which are not compatible with the current interpreter. For example, the
expression ``11/4`` currently evaluates to ``2``. If the module in which
it is executed had enabled *true division* by executing::
from __future__ import division
which are not compatible with the current interpreter.
the expression ``11/4`` would evaluate to ``2.75``. By importing the
:mod:`__future__` module and evaluating its variables, you can see when a
new feature was first added to the language and when it will become the
default::
By importing the :mod:`__future__` module and evaluating its variables,
you can see when a new feature was first added to the language and when it
becomes the default::
>>> import __future__
>>> __future__.division
...
...
@@ -271,18 +268,6 @@ Glossary
role in places where a constant hash value is needed, for example as a key
in a dictionary.
integer division
Mathematical division discarding any remainder. For example, the
expression ``11/4`` currently evaluates to ``2`` in contrast to the
``2.75`` returned by float division. Also called *floor division*. When
dividing two integers the outcome will always be another integer (having
the floor function applied to it). However, if the operands types are
different, one of them will be converted to the other's type. For
example, an integer divided by a float will result in a float value,
possibly with a decimal fraction. Integer division can be forced by using
the ``//`` operator instead of the ``/`` operator. See also
:term:`__future__`.
interactive
Python has an interactive interpreter which means you can enter
statements and expressions at the interpreter prompt, immediately
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment