@@ -139,12 +139,37 @@ available. They are listed here in alphabetical order.
139139 If no argument is given, this function returns :const: `False `.
140140
141141
142+ .. function :: bytes([arg[, encoding[, errors]]])
143+
144+ Return a new array of bytes. The :class: `bytes ` type is a mutable sequence
145+ of integers in the range 0 <= x < 256. It has most of the usual methods of
146+ mutable sequences, described in :ref: `typesseq-mutable `, as well as a few
147+ methods borrowed from strings, described in :ref: `bytes-methods `.
148+
149+ The optional *arg * parameter can be used to initialize the array in a few
150+ different ways:
151+
152+ * If it is a *string *, you must also give the *encoding * (and optionally,
153+ *errors *) parameters; :func: `bytes ` then acts like :meth: `str.encode `.
154+
155+ * If it is an *integer *, the array will have that size and will be
156+ initialized with null bytes.
157+
158+ * If it is an object conforming to the *buffer * interface, a read-only buffer
159+ of the object will be used to initialize the bytes array.
160+
161+ * If it is an *iterable *, it must be an iterable of integers in the range 0
162+ <= x < 256, which are used as the initial contents of the array.
163+
164+ Without an argument, an array of size 0 is created.
165+
166+
142167.. function :: chr(i)
143168
144- Return the string of one character whose Unicode codepoint is the integer * i *. For
145- example, ``chr(97) `` returns the string ``'a' ``. This is the inverse of
146- :func: `ord `. The valid range for the argument depends how Python was
147- configured -- it may be either UCS2 [0..0xFFFF] or UCS4 [0..0x10FFFF].
169+ Return the string of one character whose Unicode codepoint is the integer
170+ * i *. For example, ``chr(97) `` returns the string ``'a' ``. This is the
171+ inverse of :func: `ord `. The valid range for the argument depends how Python
172+ was configured -- it may be either UCS2 [0..0xFFFF] or UCS4 [0..0x10FFFF].
148173 :exc: `ValueError ` will be raised if *i * is outside that range.
149174
150175
@@ -557,15 +582,13 @@ available. They are listed here in alphabetical order.
557582
558583.. function :: isinstance(object, classinfo)
559584
560- Return true if the *object * argument is an instance of the *classinfo * argument,
561- or of a (direct or indirect) subclass thereof. Also return true if *classinfo *
562- is a type object (new-style class) and *object * is an object of that type or of
563- a (direct or indirect) subclass thereof. If *object * is not a class instance or
564- an object of the given type, the function always returns false. If *classinfo *
565- is neither a class object nor a type object, it may be a tuple of class or type
566- objects, or may recursively contain other such tuples (other sequence types are
567- not accepted). If *classinfo * is not a class, type, or tuple of classes, types,
568- and such tuples, a :exc: `TypeError ` exception is raised.
585+ Return true if the *object * argument is an instance of the *classinfo *
586+ argument, or of a (direct or indirect) subclass thereof. If *object * is not
587+ an object of the given type, the function always returns false. If
588+ *classinfo * is not a class (type object), it may be a tuple of type objects,
589+ or may recursively contain other such tuples (other sequence types are not
590+ accepted). If *classinfo * is not a type or tuple of types and such tuples,
591+ a :exc: `TypeError ` exception is raised.
569592
570593 .. versionchanged :: 2.2
571594 Support for a tuple of type information was added.
@@ -659,6 +682,13 @@ available. They are listed here in alphabetical order.
659682 Added support for the optional *key * argument.
660683
661684
685+ .. function :: memoryview(obj)
686+
687+ Return a "memory view" object created from the given argument.
688+
689+ XXX: To be documented.
690+
691+
662692.. function :: min(iterable[, args...][key])
663693
664694 With a single argument *iterable *, return the smallest item of a non-empty
@@ -682,9 +712,13 @@ available. They are listed here in alphabetical order.
682712
683713.. function :: object()
684714
685- Return a new featureless object. :class: `object ` is a base for all new style
686- classes. It has the methods that are common to all instances of new style
687- classes.
715+ Return a new featureless object. :class: `object ` is a base for all classes.
716+ It has the methods that are common to all instances of Python classes.
717+
718+ .. note ::
719+
720+ :class: `object ` does *not * have a :attr: `__dict__ `, so you can't assign
721+ arbitrary attributes to an instance of the :class: `object ` class.
688722
689723 .. versionadded :: 2.2
690724
@@ -797,8 +831,7 @@ available. They are listed here in alphabetical order.
797831
798832.. function :: property([fget[, fset[, fdel[, doc]]]])
799833
800- Return a property attribute for new-style classes (classes that derive from
801- :class: `object `).
834+ Return a property attribute.
802835
803836 *fget * is a function for getting an attribute value, likewise *fset * is a
804837 function for setting, and *fdel * a function for del'ing, an attribute. Typical
@@ -1023,11 +1056,12 @@ available. They are listed here in alphabetical order.
10231056
10241057.. function :: super(type[, object-or-type])
10251058
1059+ .. XXX need to document PEP "new super"
1060+
10261061 Return the superclass of *type *. If the second argument is omitted the super
10271062 object returned is unbound. If the second argument is an object,
10281063 ``isinstance(obj, type) `` must be true. If the second argument is a type,
1029- ``issubclass(type2, type) `` must be true. :func: `super ` only works for new-style
1030- classes.
1064+ ``issubclass(type2, type) `` must be true.
10311065
10321066 A typical use for calling a cooperative superclass method is::
10331067
@@ -1061,23 +1095,26 @@ available. They are listed here in alphabetical order.
10611095
10621096 .. index :: object: type
10631097
1064- Return the type of an *object *. The return value is a type object. The
1065- :func: `isinstance ` built-in function is recommended for testing the type of an
1066- object.
1098+ Return the type of an *object *. The return value is a type object and
1099+ generally the same object as returned by ``object.__class__ ``.
1100+
1101+ The :func: `isinstance ` built-in function is recommended for testing the type
1102+ of an object, because it takes subclasses into account.
10671103
1068- With three arguments, :func: `type ` functions as a constructor as detailed below.
1104+ With three arguments, :func: `type ` functions as a constructor as detailed
1105+ below.
10691106
10701107
10711108.. function :: type(name, bases, dict)
10721109 :noindex:
10731110
10741111 Return a new type object. This is essentially a dynamic form of the
1075- :keyword: `class ` statement. The *name * string is the class name and becomes the
1076- :attr: `__name__ ` attribute; the *bases * tuple itemizes the base classes and
1077- becomes the :attr: `__bases__ ` attribute; and the *dict * dictionary is the
1078- namespace containing definitions for class body and becomes the :attr: ` __dict__ `
1079- attribute. For example, the following two statements create identical
1080- :class: `type ` objects::
1112+ :keyword: `class ` statement. The *name * string is the class name and becomes
1113+ the :attr: `__name__ ` attribute; the *bases * tuple itemizes the base classes
1114+ and becomes the :attr: `__bases__ ` attribute; and the *dict * dictionary is the
1115+ namespace containing definitions for class body and becomes the
1116+ :attr: ` __dict__ ` attribute. For example, the following two statements create
1117+ identical :class: `type ` objects::
10811118
10821119 >>> class X(object):
10831120 ... a = 1
@@ -1128,6 +1165,7 @@ Python programmers, trainers, students and bookwriters should feel free to
11281165bypass these functions without concerns about missing something important.
11291166
11301167
1168+ .. XXX does this go away?
11311169 .. function :: buffer(object[, offset[, size]])
11321170
11331171 The *object * argument must be an object that supports the buffer call interface
0 commit comments