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
5c106640
Commit
5c106640
authored
Nov 29, 2007
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove further mentions of long integers.
parent
ba956aeb
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
53 additions
and
71 deletions
+53
-71
Doc/howto/doanddont.rst
Doc/howto/doanddont.rst
+3
-3
Doc/library/_winreg.rst
Doc/library/_winreg.rst
+3
-3
Doc/library/array.rst
Doc/library/array.rst
+2
-2
Doc/library/ctypes.rst
Doc/library/ctypes.rst
+13
-13
Doc/library/datetime.rst
Doc/library/datetime.rst
+6
-6
Doc/library/doctest.rst
Doc/library/doctest.rst
+2
-14
Doc/library/functions.rst
Doc/library/functions.rst
+3
-3
Doc/library/msilib.rst
Doc/library/msilib.rst
+1
-2
Doc/library/optparse.rst
Doc/library/optparse.rst
+6
-6
Doc/library/posix.rst
Doc/library/posix.rst
+1
-2
Doc/library/random.rst
Doc/library/random.rst
+4
-4
Doc/library/sqlite3.rst
Doc/library/sqlite3.rst
+5
-7
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+4
-6
No files found.
Doc/howto/doanddont.rst
View file @
5c106640
...
@@ -276,9 +276,9 @@ This cute little script prints the average of all numbers given on the command
...
@@ -276,9 +276,9 @@ This cute little script prints the average of all numbers given on the command
line. The :func:`reduce` adds up all the numbers, and the rest is just some
line. The :func:`reduce` adds up all the numbers, and the rest is just some
pre- and postprocessing.
pre- and postprocessing.
On the same note, note that :func:`float`
, :func:`int` and :func:`long` all
On the same note, note that :func:`float`
and :func:`int` accept arguments of
accept arguments of type string, and so are suited to parsing --- assuming you
type string, and so are suited to parsing --- assuming you are ready to deal
are ready to deal
with the :exc:`ValueError` they raise.
with the :exc:`ValueError` they raise.
Using Backslash to Continue Statements
Using Backslash to Continue Statements
...
...
Doc/library/_winreg.rst
View file @
5c106640
...
@@ -408,9 +408,9 @@ handle, and also disconnect the Windows handle from the handle object.
...
@@ -408,9 +408,9 @@ handle, and also disconnect the Windows handle from the handle object.
Detaches the Windows handle from the handle object.
Detaches the Windows handle from the handle object.
The result is an integer
(or long on 64 bit Windows) that holds the value of the
The result is an integer
that holds the value of the handle before it is
handle before it is detached. If the handle is already detached or closed, this
detached. If the handle is already detached or closed, this will return
will return
zero.
zero.
After calling this function, the handle is effectively invalidated, but the
After calling this function, the handle is effectively invalidated, but the
handle is not closed. You would call this function when you need the
handle is not closed. You would call this function when you need the
...
...
Doc/library/array.rst
View file @
5c106640
...
@@ -32,11 +32,11 @@ defined:
...
@@ -32,11 +32,11 @@ defined:
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
| ``'i'`` | signed int | int | 2 |
| ``'i'`` | signed int | int | 2 |
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
| ``'I'`` | unsigned int |
long
| 2 |
| ``'I'`` | unsigned int |
int
| 2 |
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
| ``'l'`` | signed long | int | 4 |
| ``'l'`` | signed long | int | 4 |
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
| ``'L'`` | unsigned long |
long
| 4 |
| ``'L'`` | unsigned long |
int
| 4 |
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
| ``'f'`` | float | float | 4 |
| ``'f'`` | float | float | 4 |
+-----------+----------------+-------------------+-----------------------+
+-----------+----------------+-------------------+-----------------------+
...
...
Doc/library/ctypes.rst
View file @
5c106640
...
@@ -197,11 +197,11 @@ argument values::
...
@@ -197,11 +197,11 @@ argument values::
There are, however, enough ways to crash Python with ``ctypes``, so you should
There are, however, enough ways to crash Python with ``ctypes``, so you should
be careful anyway.
be careful anyway.
``None``, integers,
longs,
byte strings and unicode strings are the only native
``None``, integers, byte strings and unicode strings are the only native
Python objects that can directly be used as parameters in these function calls.
Python objects that can directly be used as parameters in these function calls.
``None`` is passed as a C ``NULL`` pointer, byte strings and unicode strings are
``None`` is passed as a C ``NULL`` pointer, byte strings and unicode strings are
passed as pointer to the memory block that contains their data (``char *`` or
passed as pointer to the memory block that contains their data (``char *`` or
``wchar_t *``). Python integers a
nd Python longs a
re passed as the platforms
``wchar_t *``). Python integers are passed as the platforms
default C ``int`` type, their value is masked to fit into the C type.
default C ``int`` type, their value is masked to fit into the C type.
Before we move on calling functions with other parameter types, we have to learn
Before we move on calling functions with other parameter types, we have to learn
...
@@ -222,25 +222,25 @@ Fundamental data types
...
@@ -222,25 +222,25 @@ Fundamental data types
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_wchar` | ``wchar_t`` | 1-character unicode string |
| :class:`c_wchar` | ``wchar_t`` | 1-character unicode string |
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_byte` | ``char`` | int
/long
|
| :class:`c_byte` | ``char`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_ubyte` | ``unsigned char`` | int
/long
|
| :class:`c_ubyte` | ``unsigned char`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_short` | ``short`` | int
/long
|
| :class:`c_short` | ``short`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_ushort` | ``unsigned short`` | int
/long
|
| :class:`c_ushort` | ``unsigned short`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_int` | ``int`` | int
/long
|
| :class:`c_int` | ``int`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_uint` | ``unsigned int`` | int
/long
|
| :class:`c_uint` | ``unsigned int`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_long` | ``long`` | int
/long
|
| :class:`c_long` | ``long`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_ulong` | ``unsigned long`` | int
/long
|
| :class:`c_ulong` | ``unsigned long`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_longlong` | ``__int64`` or ``long long`` | int
/long
|
| :class:`c_longlong` | ``__int64`` or ``long long`` | int
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_ulonglong` | ``unsigned __int64`` or | int
/long
|
| :class:`c_ulonglong` | ``unsigned __int64`` or | int
|
| | ``unsigned long long`` | |
| | ``unsigned long long`` | |
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_float` | ``float`` | float |
| :class:`c_float` | ``float`` | float |
...
@@ -253,7 +253,7 @@ Fundamental data types
...
@@ -253,7 +253,7 @@ Fundamental data types
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` |
| :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` |
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
| :class:`c_void_p` | ``void *`` | int
/long or ``None``
|
| :class:`c_void_p` | ``void *`` | int
or ``None``
|
+----------------------+--------------------------------+----------------------------+
+----------------------+--------------------------------+----------------------------+
...
...
Doc/library/datetime.rst
View file @
5c106640
...
@@ -132,7 +132,7 @@ dates or times.
...
@@ -132,7 +132,7 @@ dates or times.
.. class:: timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]])
.. class:: timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]])
All arguments are optional and default to ``0``. Arguments may be int
s, longs,
All arguments are optional and default to ``0``. Arguments may be int
egers
or floats, and may be positive or negative.
or floats, and may be positive or negative.
Only *days*, *seconds* and *microseconds* are stored internally. Arguments are
Only *days*, *seconds* and *microseconds* are stored internally. Arguments are
...
@@ -213,7 +213,7 @@ Supported operations:
...
@@ -213,7 +213,7 @@ Supported operations:
| | == *t2* - *t3* and *t2* == *t1* + *t3* are |
| | == *t2* - *t3* and *t2* == *t1* + *t3* are |
| | true. (1) |
| | true. (1) |
+--------------------------------+-----------------------------------------------+
+--------------------------------+-----------------------------------------------+
| ``t1 = t2 * i or t1 = i * t2`` | Delta multiplied by an integer
or long.
|
| ``t1 = t2 * i or t1 = i * t2`` | Delta multiplied by an integer
.
|
| | Afterwards *t1* // i == *t2* is true, |
| | Afterwards *t1* // i == *t2* is true, |
| | provided ``i != 0``. |
| | provided ``i != 0``. |
+--------------------------------+-----------------------------------------------+
+--------------------------------+-----------------------------------------------+
...
@@ -282,7 +282,7 @@ systems.
...
@@ -282,7 +282,7 @@ systems.
.. class:: date(year, month, day)
.. class:: date(year, month, day)
All arguments are required. Arguments may be int
s or long
s, in the following
All arguments are required. Arguments may be int
eger
s, in the following
ranges:
ranges:
* ``MINYEAR <= year <= MAXYEAR``
* ``MINYEAR <= year <= MAXYEAR``
...
@@ -503,8 +503,8 @@ Constructor:
...
@@ -503,8 +503,8 @@ Constructor:
.. class:: datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
.. class:: datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
The year, month and day arguments are required. *tzinfo* may be ``None``, or an
The year, month and day arguments are required. *tzinfo* may be ``None``, or an
instance of a :class:`tzinfo` subclass. The remaining arguments may be int
s or
instance of a :class:`tzinfo` subclass. The remaining arguments may be int
egers,
longs,
in the following ranges:
in the following ranges:
* ``MINYEAR <= year <= MAXYEAR``
* ``MINYEAR <= year <= MAXYEAR``
* ``1 <= month <= 12``
* ``1 <= month <= 12``
...
@@ -932,7 +932,7 @@ day, and subject to adjustment via a :class:`tzinfo` object.
...
@@ -932,7 +932,7 @@ day, and subject to adjustment via a :class:`tzinfo` object.
.. class:: time(hour[, minute[, second[, microsecond[, tzinfo]]]])
.. class:: time(hour[, minute[, second[, microsecond[, tzinfo]]]])
All arguments are optional. *tzinfo* may be ``None``, or an instance of a
All arguments are optional. *tzinfo* may be ``None``, or an instance of a
:class:`tzinfo` subclass. The remaining arguments may be int
s or long
s, in the
:class:`tzinfo` subclass. The remaining arguments may be int
eger
s, in the
following ranges:
following ranges:
* ``0 <= hour < 24``
* ``0 <= hour < 24``
...
...
Doc/library/doctest.rst
View file @
5c106640
...
@@ -38,17 +38,10 @@ Here's a complete but small example module::
...
@@ -38,17 +38,10 @@ Here's a complete but small example module::
def factorial(n):
def factorial(n):
"""Return the factorial of n, an exact integer >= 0.
"""Return the factorial of n, an exact integer >= 0.
If the result is small enough to fit in an int, return an int.
Else return a long.
>>> [factorial(n) for n in range(6)]
>>> [factorial(n) for n in range(6)]
[1, 1, 2, 6, 24, 120]
[1, 1, 2, 6, 24, 120]
>>> [factorial(long(n)) for n in range(6)]
[1, 1, 2, 6, 24, 120]
>>> factorial(30)
>>> factorial(30)
265252859812191058636308480000000L
265252859812191058636308480000000
>>> factorial(30L)
265252859812191058636308480000000L
>>> factorial(-1)
>>> factorial(-1)
Traceback (most recent call last):
Traceback (most recent call last):
...
...
...
@@ -60,7 +53,7 @@ Here's a complete but small example module::
...
@@ -60,7 +53,7 @@ Here's a complete but small example module::
...
...
ValueError: n must be exact integer
ValueError: n must be exact integer
>>> factorial(30.0)
>>> factorial(30.0)
265252859812191058636308480000000
L
265252859812191058636308480000000
It must also not be ridiculously large:
It must also not be ridiculously large:
>>> factorial(1e100)
>>> factorial(1e100)
...
@@ -109,11 +102,6 @@ it's trying, and prints a summary at the end::
...
@@ -109,11 +102,6 @@ it's trying, and prints a summary at the end::
Expecting:
Expecting:
[1, 1, 2, 6, 24, 120]
[1, 1, 2, 6, 24, 120]
ok
ok
Trying:
[factorial(long(n)) for n in range(6)]
Expecting:
[1, 1, 2, 6, 24, 120]
ok
And so on, eventually ending with::
And so on, eventually ending with::
...
...
Doc/library/functions.rst
View file @
5c106640
...
@@ -240,8 +240,8 @@ available. They are listed here in alphabetical order.
...
@@ -240,8 +240,8 @@ available. They are listed here in alphabetical order.
interpreted as a complex number and the function must be called without a second
interpreted as a complex number and the function must be called without a second
parameter. The second parameter can never be a string. Each argument may be any
parameter. The second parameter can never be a string. Each argument may be any
numeric type (including complex). If *imag* is omitted, it defaults to zero and
numeric type (including complex). If *imag* is omitted, it defaults to zero and
the function serves as a numeric conversion function like :func:`int`
,
the function serves as a numeric conversion function like :func:`int`
:func:`long`
and :func:`float`. If both arguments are omitted, returns ``0j``.
and :func:`float`. If both arguments are omitted, returns ``0j``.
The complex type is described in :ref:`typesnumeric`.
The complex type is described in :ref:`typesnumeric`.
...
@@ -319,7 +319,7 @@ available. They are listed here in alphabetical order.
...
@@ -319,7 +319,7 @@ available. They are listed here in alphabetical order.
..
function
::
divmod
(
a
,
b
)
..
function
::
divmod
(
a
,
b
)
Take
two
(
non
complex
)
numbers
as
arguments
and
return
a
pair
of
numbers
Take
two
(
non
complex
)
numbers
as
arguments
and
return
a
pair
of
numbers
consisting
of
their
quotient
and
remainder
when
using
long
division
.
With
mixed
consisting
of
their
quotient
and
remainder
when
using
integer
division
.
With
mixed
operand
types
,
the
rules
for
binary
arithmetic
operators
apply
.
For
integers
,
operand
types
,
the
rules
for
binary
arithmetic
operators
apply
.
For
integers
,
the
result
is
the
same
as
``(
a
//
b
,
a
%
b
)``.
For
floating
point
the
result
is
the
same
as
``(
a
//
b
,
a
%
b
)``.
For
floating
point
numbers
the
result
is
``(
q
,
a
%
b
)``,
where
*
q
*
is
usually
``
math
.
floor
(
a
/
b
)``
numbers
the
result
is
``(
q
,
a
%
b
)``,
where
*
q
*
is
usually
``
math
.
floor
(
a
/
b
)``
...
...
Doc/library/msilib.rst
View file @
5c106640
...
@@ -83,8 +83,7 @@ structures.
...
@@ -83,8 +83,7 @@ structures.
containing
all
fields
of
a
record
according
to
the
schema
of
the
table
.
For
containing
all
fields
of
a
record
according
to
the
schema
of
the
table
.
For
optional
fields
,
``
None
``
can
be
passed
.
optional
fields
,
``
None
``
can
be
passed
.
Field
values
can
be
int
or
long
numbers
,
strings
,
or
instances
of
the
Binary
Field
values
can
be
integers
,
strings
,
or
instances
of
the
Binary
class
.
class
.
..
class
::
Binary
(
filename
)
..
class
::
Binary
(
filename
)
...
...
Doc/library/optparse.rst
View file @
5c106640
...
@@ -364,7 +364,7 @@ default from the option strings: if the first long option string is
...
@@ -364,7 +364,7 @@ default from the option strings: if the first long option string is
long option strings, :mod:`optparse` looks at the first short option string: the
long option strings, :mod:`optparse` looks at the first short option string: the
default destination for ``"-f"`` is ``f``.
default destination for ``"-f"`` is ``f``.
:mod:`optparse` also includes
built-in ``long`` and ``complex`` types
. Adding
:mod:`optparse` also includes
the built-in ``complex`` type
. Adding
types is covered in section :ref:`optparse-extending-optparse`.
types is covered in section :ref:`optparse-extending-optparse`.
...
@@ -1103,14 +1103,14 @@ to a particular option, or fail to pass a required option attribute,
...
@@ -1103,14 +1103,14 @@ to a particular option, or fail to pass a required option attribute,
Standard option types
Standard option types
^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^
:mod:`optparse`
has
six built-in option types: ``string``, ``int``, ``long
``,
:mod:`optparse`
has
five built-in option types: ``string``, ``int
``,
``choice``,
``float`` and ``complex``. If you need to add new option types, see
``choice``,
``float`` and ``complex``. If you need to add new option types, see
section :ref:`optparse-extending-optparse`.
section :ref:`optparse-extending-optparse`.
Arguments to string options are not checked or converted in any way: the text on
Arguments to string options are not checked or converted in any way: the text on
the command line is stored in the destination (or passed to the callback) as-is.
the command line is stored in the destination (or passed to the callback) as-is.
Integer arguments (type ``int``
or ``long``
) are parsed as follows:
Integer arguments (type ``int``) are parsed as follows:
* if the number starts with ``0x``, it is parsed as a hexadecimal number
* if the number starts with ``0x``, it is parsed as a hexadecimal number
...
@@ -1121,9 +1121,9 @@ Integer arguments (type ``int`` or ``long``) are parsed as follows:
...
@@ -1121,9 +1121,9 @@ Integer arguments (type ``int`` or ``long``) are parsed as follows:
* otherwise, the number is parsed as a decimal number
* otherwise, the number is parsed as a decimal number
The conversion is done by calling
either ``int()`` or ``long()`` with the
The conversion is done by calling
``int()`` with the appropriate base (2, 8, 10,
appropriate base (2, 8, 10, or 16). If this fails, so will :mod:`optparse`,
or 16). If this fails, so will :mod:`optparse`, although with a more useful
although with a more useful
error message.
error message.
``float`` and ``complex`` option arguments are converted directly with
``float`` and ``complex`` option arguments are converted directly with
``float()``
and ``complex()``, with similar error-handling.
``float()``
and ``complex()``, with similar error-handling.
...
...
Doc/library/posix.rst
View file @
5c106640
...
@@ -51,8 +51,7 @@ sometimes referred to as :dfn:`large files`.
...
@@ -51,8 +51,7 @@ sometimes referred to as :dfn:`large files`.
Large file support is enabled in Python when the size of an :ctype:`off_t` is
Large file support is enabled in Python when the size of an :ctype:`off_t` is
larger than a :ctype:`long` and the :ctype:`long long` type is available and is
larger than a :ctype:`long` and the :ctype:`long long` type is available and is
at least as large as an :ctype:`off_t`. Python longs are then used to represent
at least as large as an :ctype:`off_t`.
file sizes, offsets and other values that can exceed the range of a Python int.
It may be necessary to configure and compile Python with certain compiler flags
It may be necessary to configure and compile Python with certain compiler flags
to enable this mode. For example, it is enabled by default with recent versions
to enable this mode. For example, it is enabled by default with recent versions
of Irix, but with Solaris 2.6 and 2.7 you need to do something like::
of Irix, but with Solaris 2.6 and 2.7 you need to do something like::
...
...
Doc/library/random.rst
View file @
5c106640
...
@@ -60,8 +60,8 @@ Bookkeeping functions:
...
@@ -60,8 +60,8 @@ Bookkeeping functions:
they are used instead of the system time (see the :func:`os.urandom` function
they are used instead of the system time (see the :func:`os.urandom` function
for details on availability).
for details on availability).
If *x* is not ``None`` or an int
or long, ``hash(x)`` is used instead. If *x* is
If *x* is not ``None`` or an int
, ``hash(x)`` is used instead. If *x* is an
an int or long
, *x* is used directly.
int
, *x* is used directly.
.. function:: getstate()
.. function:: getstate()
...
@@ -90,8 +90,8 @@ Bookkeeping functions:
...
@@ -90,8 +90,8 @@ Bookkeeping functions:
.. function:: getrandbits(k)
.. function:: getrandbits(k)
Returns a python
:class:`long` int with *k* random bits. This method is supplied
Returns a python
integer with *k* random bits. This method is supplied with
with
the MersenneTwister generator and some other generators may also provide it
the MersenneTwister generator and some other generators may also provide it
as an optional part of the API. When available, :meth:`getrandbits` enables
as an optional part of the API. When available, :meth:`getrandbits` enables
:meth:`randrange` to handle arbitrarily large ranges.
:meth:`randrange` to handle arbitrarily large ranges.
...
...
Doc/library/sqlite3.rst
View file @
5c106640
...
@@ -184,7 +184,7 @@ Module functions and constants
...
@@ -184,7 +184,7 @@ Module functions and constants
Registers a callable to convert the custom Python type *type* into one of
Registers a callable to convert the custom Python type *type* into one of
SQLite's supported types. The callable *callable* accepts as single parameter
SQLite's supported types. The callable *callable* accepts as single parameter
the Python value, and must return a value of the following types: int,
long,
the Python value, and must return a value of the following types: int,
float, str (UTF-8 encoded), unicode or buffer.
float, str (UTF-8 encoded), unicode or buffer.
...
@@ -260,7 +260,7 @@ A :class:`Connection` instance has the following attributes and methods:
...
@@ -260,7 +260,7 @@ A :class:`Connection` instance has the following attributes and methods:
as the SQL function.
as the SQL function.
The function can return any of the types supported by SQLite: unicode, str, int,
The function can return any of the types supported by SQLite: unicode, str, int,
long,
float, buffer and None.
float, buffer and None.
Example:
Example:
...
@@ -276,7 +276,7 @@ A :class:`Connection` instance has the following attributes and methods:
...
@@ -276,7 +276,7 @@ A :class:`Connection` instance has the following attributes and methods:
final result of the aggregate.
final result of the aggregate.
The ``finalize`` method can return any of the types supported by SQLite:
The ``finalize`` method can return any of the types supported by SQLite:
unicode, str, int,
long,
float, buffer and None.
unicode, str, int, float, buffer and None.
Example:
Example:
...
@@ -472,8 +472,6 @@ The following Python types can thus be sent to SQLite without any problem:
...
@@ -472,8 +472,6 @@ The following Python types can thus be sent to SQLite without any problem:
+------------------------+-------------+
+------------------------+-------------+
| ``int`` | INTEGER |
| ``int`` | INTEGER |
+------------------------+-------------+
+------------------------+-------------+
| ``long`` | INTEGER |
+------------------------+-------------+
| ``float`` | REAL |
| ``float`` | REAL |
+------------------------+-------------+
+------------------------+-------------+
| ``str (UTF8-encoded)`` | TEXT |
| ``str (UTF8-encoded)`` | TEXT |
...
@@ -490,7 +488,7 @@ This is how SQLite types are converted to Python types by default:
...
@@ -490,7 +488,7 @@ This is how SQLite types are converted to Python types by default:
+=============+=============================================+
+=============+=============================================+
| ``NULL`` | None |
| ``NULL`` | None |
+-------------+---------------------------------------------+
+-------------+---------------------------------------------+
| ``INTEGER`` | int
or long, depending on size
|
| ``INTEGER`` | int
|
+-------------+---------------------------------------------+
+-------------+---------------------------------------------+
| ``REAL`` | float |
| ``REAL`` | float |
+-------------+---------------------------------------------+
+-------------+---------------------------------------------+
...
@@ -510,7 +508,7 @@ Using adapters to store additional Python types in SQLite databases
...
@@ -510,7 +508,7 @@ Using adapters to store additional Python types in SQLite databases
As described before, SQLite supports only a limited set of types natively. To
As described before, SQLite supports only a limited set of types natively. To
use other Python types with SQLite, you must **adapt** them to one of the
use other Python types with SQLite, you must **adapt** them to one of the
sqlite3 module's supported types for SQLite: one of NoneType, int,
long,
float,
sqlite3 module's supported types for SQLite: one of NoneType, int, float,
str, unicode, buffer.
str, unicode, buffer.
The :mod:`sqlite3` module uses Python object adaptation, as described in
The :mod:`sqlite3` module uses Python object adaptation, as described in
...
...
Doc/reference/datamodel.rst
View file @
5c106640
...
@@ -1490,7 +1490,7 @@ Notes on using *__slots__*
...
@@ -1490,7 +1490,7 @@ Notes on using *__slots__*
*__slots__*.
*__slots__*.
* *__slots__* do not work for classes derived from "variable-length" built-in
* *__slots__* do not work for classes derived from "variable-length" built-in
types such as :class:`
long
`, :class:`str` and :class:`tuple`.
types such as :class:`
int
`, :class:`str` and :class:`tuple`.
* Any non-string iterable may be assigned to *__slots__*. Mappings may also be
* Any non-string iterable may be assigned to *__slots__*. Mappings may also be
used; however, in the future, special meaning may be assigned to the values
used; however, in the future, special meaning may be assigned to the values
...
@@ -1808,24 +1808,22 @@ left undefined.
...
@@ -1808,24 +1808,22 @@ left undefined.
.. method:: object.__complex__(self)
.. method:: object.__complex__(self)
object.__int__(self)
object.__int__(self)
object.__long__(self)
object.__float__(self)
object.__float__(self)
.. index::
.. index::
builtin: complex
builtin: complex
builtin: int
builtin: int
builtin: long
builtin: float
builtin: float
Called to implement the built-in functions :func:`complex`, :func:`int`
,
Called to implement the built-in functions :func:`complex`, :func:`int`
:func:`long`,
and :func:`float`. Should return a value of the appropriate type.
and :func:`float`. Should return a value of the appropriate type.
.. method:: object.__index__(self)
.. method:: object.__index__(self)
Called to implement :func:`operator.index`. Also called whenever Python needs
Called to implement :func:`operator.index`. Also called whenever Python needs
an integer object (such as in slicing, or in the built-in :func:`bin`,
an integer object (such as in slicing, or in the built-in :func:`bin`,
:func:`hex` and :func:`oct` functions). Must return an integer
(int or long)
.
:func:`hex` and :func:`oct` functions). Must return an integer.
.. _context-managers:
.. _context-managers:
...
...
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