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

Skip to content

Commit c53bc48

Browse files
committed
merge with 3.4
2 parents b65ff1d + eb7e8f6 commit c53bc48

1 file changed

Lines changed: 41 additions & 41 deletions

File tree

Doc/library/functions.rst

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,22 @@ are always available. They are listed here in alphabetical order.
8585
:meth:`__index__` method that returns an integer.
8686

8787

88-
.. function:: bool([x])
88+
.. class:: bool([x])
8989

90-
Convert a value to a Boolean, using the standard :ref:`truth testing
91-
procedure <truth>`. If *x* is false or omitted, this returns ``False``;
92-
otherwise it returns ``True``. :class:`bool` is also a class, which is a
93-
subclass of :class:`int` (see :ref:`typesnumeric`). Class :class:`bool`
94-
cannot be subclassed further. Its only instances are ``False`` and
90+
Return a Boolean value, i.e. one of ``True`` or ``False``. *x* is converted
91+
using the standard :ref:`truth testing procedure <truth>`. If *x* is false
92+
or omitted, this returns ``False``; otherwise it returns ``True``. The
93+
:class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`).
94+
It cannot be subclassed further. Its only instances are ``False`` and
9595
``True`` (see :ref:`bltin-boolean-values`).
9696

9797
.. index:: pair: Boolean; type
9898

9999

100100
.. _func-bytearray:
101-
.. function:: bytearray([source[, encoding[, errors]]])
101+
.. class:: bytearray([source[, encoding[, errors]]])
102102

103-
Return a new array of bytes. The :class:`bytearray` type is a mutable
103+
Return a new array of bytes. The :class:`bytearray` class is a mutable
104104
sequence of integers in the range 0 <= x < 256. It has most of the usual
105105
methods of mutable sequences, described in :ref:`typesseq-mutable`, as well
106106
as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`.
@@ -127,7 +127,7 @@ are always available. They are listed here in alphabetical order.
127127

128128

129129
.. _func-bytes:
130-
.. function:: bytes([source[, encoding[, errors]]])
130+
.. class:: bytes([source[, encoding[, errors]]])
131131

132132
Return a new "bytes" object, which is an immutable sequence of integers in
133133
the range ``0 <= x < 256``. :class:`bytes` is an immutable version of
@@ -244,15 +244,16 @@ are always available. They are listed here in alphabetical order.
244244
does not have to end in a newline anymore. Added the *optimize* parameter.
245245

246246

247-
.. function:: complex([real[, imag]])
247+
.. class:: complex([real[, imag]])
248248

249-
Create a complex number with the value *real* + *imag*\*j or convert a string or
250-
number to a complex number. If the first parameter is a string, it will be
251-
interpreted as a complex number and the function must be called without a second
252-
parameter. The second parameter can never be a string. Each argument may be any
253-
numeric type (including complex). If *imag* is omitted, it defaults to zero and
254-
the function serves as a numeric conversion function like :func:`int`
255-
and :func:`float`. If both arguments are omitted, returns ``0j``.
249+
Return a complex number with the value *real* + *imag*\*j or convert a string
250+
or number to a complex number. If the first parameter is a string, it will
251+
be interpreted as a complex number and the function must be called without a
252+
second parameter. The second parameter can never be a string. Each argument
253+
may be any numeric type (including complex). If *imag* is omitted, it
254+
defaults to zero and the constructor serves as a numeric conversion like
255+
:class:`int` and :class:`float`. If both arguments are omitted, returns
256+
``0j``.
256257

257258
.. note::
258259

@@ -273,14 +274,13 @@ are always available. They are listed here in alphabetical order.
273274

274275

275276
.. _func-dict:
276-
.. function:: dict(**kwarg)
277-
dict(mapping, **kwarg)
278-
dict(iterable, **kwarg)
277+
.. class:: dict(**kwarg)
278+
dict(mapping, **kwarg)
279+
dict(iterable, **kwarg)
279280
:noindex:
280281
281282
Create a new dictionary. The :class:`dict` object is the dictionary class.
282-
See :class:`dict` and :ref:`typesmapping` for documentation about this
283-
class.
283+
See :class:`dict` and :ref:`typesmapping` for documentation about this class.
284284

285285
For other containers see the built-in :class:`list`, :class:`set`, and
286286
:class:`tuple` classes, as well as the :mod:`collections` module.
@@ -471,13 +471,13 @@ are always available. They are listed here in alphabetical order.
471471
elements of *iterable* for which *function* returns false.
472472

473473

474-
.. function:: float([x])
474+
.. class:: float([x])
475475

476476
.. index::
477477
single: NaN
478478
single: Infinity
479479

480-
Convert a string or a number to floating point.
480+
Return a floating point number constructed from a number or string *x*.
481481

482482
If the argument is a string, it should contain a decimal number, optionally
483483
preceded by a sign, and optionally embedded in whitespace. The optional
@@ -552,7 +552,7 @@ are always available. They are listed here in alphabetical order.
552552

553553

554554
.. _func-frozenset:
555-
.. function:: frozenset([iterable])
555+
.. class:: frozenset([iterable])
556556
:noindex:
557557

558558
Return a new :class:`frozenset` object, optionally with elements taken from
@@ -665,12 +665,13 @@ are always available. They are listed here in alphabetical order.
665665
to provide elaborate line editing and history features.
666666

667667

668-
.. function:: int(x=0)
669-
int(x, base=10)
668+
.. class:: int(x=0)
669+
int(x, base=10)
670670

671-
Convert a number or string *x* to an integer, or return ``0`` if no
672-
arguments are given. If *x* is a number, return :meth:`x.__int__()
673-
<object.__int__>`. For floating point numbers, this truncates towards zero.
671+
Return an integer object constructed from a number or string *x*, or return
672+
``0`` if no arguments are given. If *x* is a number, return
673+
:meth:`x.__int__() <object.__int__>`. For floating point numbers, this
674+
truncates towards zero.
674675

675676
If *x* is not a number or if *base* is given, then *x* must be a string,
676677
:class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer
@@ -749,7 +750,7 @@ are always available. They are listed here in alphabetical order.
749750

750751

751752
.. _func-list:
752-
.. function:: list([iterable])
753+
.. class:: list([iterable])
753754
:noindex:
754755

755756
Rather than being a function, :class:`list` is actually a mutable
@@ -843,7 +844,7 @@ are always available. They are listed here in alphabetical order.
843844
if the iterator is exhausted, otherwise :exc:`StopIteration` is raised.
844845

845846

846-
.. function:: object()
847+
.. class:: object()
847848

848849
Return a new featureless object. :class:`object` is a base for all classes.
849850
It has the methods that are common to all instances of Python classes. This
@@ -1105,7 +1106,7 @@ are always available. They are listed here in alphabetical order.
11051106
Added the *flush* keyword argument.
11061107

11071108

1108-
.. function:: property(fget=None, fset=None, fdel=None, doc=None)
1109+
.. class:: property(fget=None, fset=None, fdel=None, doc=None)
11091110

11101111
Return a property attribute.
11111112

@@ -1231,7 +1232,7 @@ are always available. They are listed here in alphabetical order.
12311232

12321233

12331234
.. _func-set:
1234-
.. function:: set([iterable])
1235+
.. class:: set([iterable])
12351236
:noindex:
12361237

12371238
Return a new :class:`set` object, optionally with elements taken from
@@ -1252,8 +1253,8 @@ are always available. They are listed here in alphabetical order.
12521253
``x.foobar = 123``.
12531254

12541255

1255-
.. function:: slice(stop)
1256-
slice(start, stop[, step])
1256+
.. class:: slice(stop)
1257+
slice(start, stop[, step])
12571258

12581259
.. index:: single: Numerical Python
12591260

@@ -1316,8 +1317,8 @@ are always available. They are listed here in alphabetical order.
13161317

13171318

13181319
.. _func-str:
1319-
.. function:: str(object='')
1320-
str(object=b'', encoding='utf-8', errors='strict')
1320+
.. class:: str(object='')
1321+
str(object=b'', encoding='utf-8', errors='strict')
13211322
:noindex:
13221323

13231324
Return a :class:`str` version of *object*. See :func:`str` for details.
@@ -1404,12 +1405,11 @@ are always available. They are listed here in alphabetical order.
14041405
sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`.
14051406

14061407

1407-
.. function:: type(object)
1408-
type(name, bases, dict)
1408+
.. class:: type(object)
1409+
type(name, bases, dict)
14091410

14101411
.. index:: object: type
14111412

1412-
14131413
With one argument, return the type of an *object*. The return value is a
14141414
type object and generally the same object as returned by
14151415
:attr:`object.__class__ <instance.__class__>`.

0 commit comments

Comments
 (0)