@@ -150,8 +150,8 @@ Some well-known APIs no longer return lists:
150150 sorted(d) `` instead (this works in Python 2.5 too and is just
151151 as efficient).
152152
153- * Also, the :meth: `dict.iterkeys `, :meth: `dict.iteritems ` and
154- :meth: `dict.itervalues ` methods are no longer supported.
153+ * Also, the :meth: `! dict.iterkeys `, :meth: `! dict.iteritems ` and
154+ :meth: `! dict.itervalues ` methods are no longer supported.
155155
156156* :func: `map ` and :func: `filter ` return iterators. If you really need
157157 a list and the input sequences are all of equal length, a quick
@@ -170,7 +170,7 @@ Some well-known APIs no longer return lists:
170170 :func: `itertools.zip_longest `, e.g. ``map(func, *sequences) `` becomes
171171 ``list(map(func, itertools.zip_longest(*sequences))) ``.
172172
173- * :func: `range ` now behaves like :func: `xrange ` used to behave, except
173+ * :func: `range ` now behaves like :func: `! xrange ` used to behave, except
174174 it works with values of arbitrary size. The latter no longer
175175 exists.
176176
@@ -192,33 +192,33 @@ Python 3.0 has simplified the rules for ordering comparisons:
192192 operators: objects of different incomparable types always compare
193193 unequal to each other.
194194
195- * :meth: `builtin. sorted ` and :meth: `list.sort ` no longer accept the
195+ * :meth: `sorted ` and :meth: `list.sort ` no longer accept the
196196 *cmp * argument providing a comparison function. Use the *key *
197197 argument instead. N.B. the *key * and *reverse * arguments are now
198198 "keyword-only".
199199
200- * The :func: `cmp ` function should be treated as gone, and the :meth: `__cmp__ `
201- special method is no longer supported. Use :meth: `__lt__ ` for sorting,
202- :meth: `__eq__ ` with :meth: `__hash__ `, and other rich comparisons as needed.
203- (If you really need the :func: `cmp ` functionality, you could use the
200+ * The :func: `! cmp ` function should be treated as gone, and the :meth: `! __cmp__ `
201+ special method is no longer supported. Use :meth: `~object. __lt__ ` for sorting,
202+ :meth: `~object. __eq__ ` with :meth: `~object. __hash__ `, and other rich comparisons as needed.
203+ (If you really need the :func: `! cmp ` functionality, you could use the
204204 expression ``(a > b) - (a < b) `` as the equivalent for ``cmp(a, b) ``.)
205205
206206Integers
207207--------
208208
209- * :pep: `237 `: Essentially, :class: `long ` renamed to :class: `int `.
209+ * :pep: `237 `: Essentially, :class: `! long ` renamed to :class: `int `.
210210 That is, there is only one built-in integral type, named
211- :class: `int `; but it behaves mostly like the old :class: `long ` type.
211+ :class: `int `; but it behaves mostly like the old :class: `! long ` type.
212212
213213* :pep: `238 `: An expression like ``1/2 `` returns a float. Use
214214 ``1//2 `` to get the truncating behavior. (The latter syntax has
215215 existed for years, at least since Python 2.2.)
216216
217- * The :data: `sys.maxint ` constant was removed, since there is no
217+ * The :data: `! sys.maxint ` constant was removed, since there is no
218218 longer a limit to the value of integers. However, :data: `sys.maxsize `
219219 can be used as an integer larger than any practical list or string
220220 index. It conforms to the implementation's "natural" integer size
221- and is typically the same as :data: `sys.maxint ` in previous releases
221+ and is typically the same as :data: `! sys.maxint ` in previous releases
222222 on the same platform (assuming the same build options).
223223
224224* The :func: `repr ` of a long integer doesn't include the trailing ``L ``
@@ -251,7 +251,7 @@ changed.
251251 that uses Unicode, encodings or binary data most likely has to
252252 change. The change is for the better, as in the 2.x world there
253253 were numerous bugs having to do with mixing encoded and unencoded
254- text. To be prepared in Python 2.x, start using :class: `unicode `
254+ text. To be prepared in Python 2.x, start using :class: `! unicode `
255255 for all unencoded text, and :class: `str ` for binary or encoded data
256256 only. Then the ``2to3 `` tool will do most of the work for you.
257257
@@ -269,7 +269,7 @@ changed.
269269 separate *mutable * type to hold buffered binary data,
270270 :class: `bytearray `. Nearly all APIs that accept :class: `bytes ` also
271271 accept :class: `bytearray `. The mutable API is based on
272- :class: `collections.MutableSequence `.
272+ :class: `collections.MutableSequence <collections.abc.MutableSequence> `.
273273
274274* All backslashes in raw string literals are interpreted literally.
275275 This means that ``'\U' `` and ``'\u' `` escapes in raw strings are not
@@ -278,11 +278,11 @@ changed.
278278 single "euro" character. (Of course, this change only affects raw
279279 string literals; the euro character is ``'\u20ac' `` in Python 3.0.)
280280
281- * The built-in :class: `basestring ` abstract type was removed. Use
281+ * The built-in :class: `! basestring ` abstract type was removed. Use
282282 :class: `str ` instead. The :class: `str ` and :class: `bytes ` types
283283 don't have functionality enough in common to warrant a shared base
284284 class. The ``2to3 `` tool (see below) replaces every occurrence of
285- :class: `basestring ` with :class: `str `.
285+ :class: `! basestring ` with :class: `str `.
286286
287287* Files opened as text files (still the default mode for :func: `open `)
288288 always use an encoding to map between strings (in memory) and bytes
@@ -428,7 +428,7 @@ Changed Syntax
428428 class C(metaclass=M):
429429 ...
430430
431- The module-global :data:`__metaclass__` variable is no longer
431+ The module-global :data:`! __metaclass__` variable is no longer
432432 supported. (It was a crutch to make it easier to default to
433433 new-style classes without deriving every class from
434434 :class:`object`.)
@@ -522,19 +522,19 @@ consulted for longer descriptions.
522522 *encoding *, *errors *, *newline * and *closefd *. Also note that an
523523 invalid *mode * argument now raises :exc: `ValueError `, not
524524 :exc: `IOError `. The binary file object underlying a text file
525- object can be accessed as :attr: `f.buffer ` (but beware that the
525+ object can be accessed as :attr: `! f.buffer ` (but beware that the
526526 text object maintains a buffer of itself in order to speed up
527527 the encoding and decoding operations).
528528
529- * :ref: `pep-3118 `. The old builtin :func: `buffer ` is now really gone;
529+ * :ref: `pep-3118 `. The old builtin :func: `! buffer ` is now really gone;
530530 the new builtin :func: `memoryview ` provides (mostly) similar
531531 functionality.
532532
533533* :ref: `pep-3119 `. The :mod: `abc ` module and the ABCs defined in the
534534 :mod: `collections ` module plays a somewhat more prominent role in
535535 the language now, and built-in collection types like :class: `dict `
536- and :class: `list ` conform to the :class: `collections.MutableMapping `
537- and :class: `collections.MutableSequence ` ABCs, respectively.
536+ and :class: `list ` conform to the :class: `collections.MutableMapping <collections.abc.MutableMapping> `
537+ and :class: `collections.MutableSequence <collections.abc.MutableSequence> ` ABCs, respectively.
538538
539539* :ref: `pep-3127 `. As mentioned above, the new octal literal
540540 notation is the only one supported, and binary literals have been
@@ -612,7 +612,7 @@ review:
612612 :mod: `!CGIHTTPServer `, :mod: `!SimpleHTTPServer `, :mod: `!Cookie `,
613613 :mod: `!cookielib `).
614614
615- * :mod: `tkinter ` (all :mod: ` Tkinter `-related modules except
615+ * :mod: `tkinter ` (all `` Tkinter ` `-related modules except
616616 :mod: `turtle `). The target audience of :mod: `turtle ` doesn't
617617 really care about :mod: `tkinter `. Also note that as of Python
618618 2.6, the functionality of :mod: `turtle ` has been greatly enhanced.
@@ -628,47 +628,47 @@ Some other changes to standard library modules, not covered by
628628
629629* Killed :mod: `!sets `. Use the built-in :func: `set ` class.
630630
631- * Cleanup of the :mod: `sys ` module: removed :func: `sys.exitfunc `,
632- :func: `sys.exc_clear `, :data: `sys.exc_type `, :data: `sys.exc_value `,
633- :data: `sys.exc_traceback `. (Note that :data: `sys.last_type `
631+ * Cleanup of the :mod: `sys ` module: removed :func: `! sys.exitfunc `,
632+ :func: `! sys.exc_clear `, :data: `! sys.exc_type `, :data: `! sys.exc_value `,
633+ :data: `! sys.exc_traceback `. (Note that :data: `sys.last_type `
634634 etc. remain.)
635635
636- * Cleanup of the :class: `array.array ` type: the :meth: `read ` and
637- :meth: `write ` methods are gone; use :meth: `fromfile ` and
638- :meth: `tofile ` instead. Also, the ``'c' `` typecode for array is
636+ * Cleanup of the :class: `array.array ` type: the :meth: `! read ` and
637+ :meth: `! write ` methods are gone; use :meth: `~array.array. fromfile ` and
638+ :meth: `~array.array. tofile ` instead. Also, the ``'c' `` typecode for array is
639639 gone -- use either ``'b' `` for bytes or ``'u' `` for Unicode
640640 characters.
641641
642642* Cleanup of the :mod: `operator ` module: removed
643- :func: `sequenceIncludes ` and :func: `isCallable `.
643+ :func: `! sequenceIncludes ` and :func: `! isCallable `.
644644
645645* Cleanup of the :mod: `!thread ` module: :func: `!acquire_lock ` and
646646 :func: `!release_lock ` are gone; use :meth: `~threading.Lock.acquire ` and
647647 :meth: `~threading.Lock.release ` instead.
648648
649- * Cleanup of the :mod: `random ` module: removed the :func: `jumpahead ` API.
649+ * Cleanup of the :mod: `random ` module: removed the :func: `! jumpahead ` API.
650650
651651* The :mod: `!new ` module is gone.
652652
653- * The functions :func: `os.tmpnam `, :func: `os.tempnam ` and
654- :func: `os.tmpfile ` have been removed in favor of the :mod: `tempfile `
653+ * The functions :func: `! os.tmpnam `, :func: `! os.tempnam ` and
654+ :func: `! os.tmpfile ` have been removed in favor of the :mod: `tempfile `
655655 module.
656656
657657* The :mod: `tokenize ` module has been changed to work with bytes. The
658658 main entry point is now :func: `tokenize.tokenize `, instead of
659659 generate_tokens.
660660
661- * :data: `string.letters ` and its friends (:data: `string.lowercase ` and
662- :data: `string.uppercase `) are gone. Use
661+ * :data: `! string.letters ` and its friends (:data: `! string.lowercase ` and
662+ :data: `! string.uppercase `) are gone. Use
663663 :data: `string.ascii_letters ` etc. instead. (The reason for the
664- removal is that :data: `string.letters ` and friends had
664+ removal is that :data: `! string.letters ` and friends had
665665 locale-specific behavior, which is a bad idea for such
666666 attractively named global "constants".)
667667
668- * Renamed module :mod: `__builtin__ ` to :mod: `builtins ` (removing the
669- underscores, adding an 's'). The :data: `__builtins__ ` variable
668+ * Renamed module :mod: `! __builtin__ ` to :mod: `builtins ` (removing the
669+ underscores, adding an 's'). The :data: `! __builtins__ ` variable
670670 found in most global namespaces is unchanged. To modify a builtin,
671- you should use :mod: `builtins `, not :data: `__builtins__ `!
671+ you should use :mod: `builtins `, not :data: `! __builtins__ `!
672672
673673
674674:pep: `3101 `: A New Approach To String Formatting
@@ -702,9 +702,9 @@ new powerful features added:
702702 idiom for handling all exceptions except for this latter category is
703703 to use :keyword: `except ` :exc: `Exception `.
704704
705- * :exc: `StandardError ` was removed.
705+ * :exc: `! StandardError ` was removed.
706706
707- * Exceptions no longer behave as sequences. Use the :attr: `args `
707+ * Exceptions no longer behave as sequences. Use the :attr: `~BaseException. args `
708708 attribute instead.
709709
710710* :pep: `3109 `: Raising exceptions. You must now use :samp: `raise
@@ -765,20 +765,20 @@ Operators And Special Methods
765765 When referencing a method as a class attribute, you now get a plain
766766 function object.
767767
768- * :meth: `__getslice__ `, :meth: `__setslice__ ` and :meth: `__delslice__ `
768+ * :meth: `! __getslice__ `, :meth: `! __setslice__ ` and :meth: `! __delslice__ `
769769 were killed. The syntax ``a[i:j] `` now translates to
770- ``a.__getitem__(slice(i, j)) `` (or :meth: `__setitem__ ` or
771- :meth: `__delitem__ `, when used as an assignment or deletion target,
770+ ``a.__getitem__(slice(i, j)) `` (or :meth: `~object. __setitem__ ` or
771+ :meth: `~object. __delitem__ `, when used as an assignment or deletion target,
772772 respectively).
773773
774774* :pep: `3114 `: the standard :meth: `next ` method has been renamed to
775775 :meth: `~iterator.__next__ `.
776776
777- * The :meth: `__oct__ ` and :meth: `__hex__ ` special methods are removed
778- -- :func: `oct ` and :func: `hex ` use :meth: `__index__ ` now to convert
777+ * The :meth: `! __oct__ ` and :meth: `! __hex__ ` special methods are removed
778+ -- :func: `oct ` and :func: `hex ` use :meth: `~object. __index__ ` now to convert
779779 the argument to an integer.
780780
781- * Removed support for :attr: `__members__ ` and :attr: `__methods__ `.
781+ * Removed support for :attr: `! __members__ ` and :attr: `! __methods__ `.
782782
783783* The function attributes named :attr: `!func_X ` have been renamed to
784784 use the :attr: `!__X__ ` form, freeing up these names in the function
@@ -802,7 +802,7 @@ Builtins
802802 instance will automatically be chosen. With arguments, the behavior
803803 of :func: `super ` is unchanged.
804804
805- * :pep: `3111 `: :func: `raw_input ` was renamed to :func: `input `. That
805+ * :pep: `3111 `: :func: `! raw_input ` was renamed to :func: `input `. That
806806 is, the new :func: `input ` function reads a line from
807807 :data: `sys.stdin ` and returns it with the trailing newline stripped.
808808 It raises :exc: `EOFError ` if the input is terminated prematurely.
@@ -820,31 +820,31 @@ Builtins
820820 argument and a value of the same type as ``x `` when called with two
821821 arguments.
822822
823- * Moved :func: `intern ` to :func: `sys.intern `.
823+ * Moved :func: `! intern ` to :func: `sys.intern `.
824824
825- * Removed: :func: `apply `. Instead of ``apply(f, args) `` use
825+ * Removed: :func: `! apply `. Instead of ``apply(f, args) `` use
826826 ``f(*args) ``.
827827
828828* Removed :func: `callable `. Instead of ``callable(f) `` you can use
829- ``isinstance(f, collections.Callable) ``. The :func: `operator.isCallable `
829+ ``isinstance(f, collections.Callable) ``. The :func: `! operator.isCallable `
830830 function is also gone.
831831
832- * Removed :func: `coerce `. This function no longer serves a purpose
832+ * Removed :func: `! coerce `. This function no longer serves a purpose
833833 now that classic classes are gone.
834834
835- * Removed :func: `execfile `. Instead of ``execfile(fn) `` use
835+ * Removed :func: `! execfile `. Instead of ``execfile(fn) `` use
836836 ``exec(open(fn).read()) ``.
837837
838- * Removed the :class: `file ` type. Use :func: `open `. There are now several
838+ * Removed the :class: `! file ` type. Use :func: `open `. There are now several
839839 different kinds of streams that open can return in the :mod: `io ` module.
840840
841- * Removed :func: `reduce `. Use :func: `functools.reduce ` if you really
841+ * Removed :func: `! reduce `. Use :func: `functools.reduce ` if you really
842842 need it; however, 99 percent of the time an explicit :keyword: `for `
843843 loop is more readable.
844844
845- * Removed :func: `reload `. Use :func: `!imp.reload `.
845+ * Removed :func: `! reload `. Use :func: `!imp.reload `.
846846
847- * Removed. :meth: `dict.has_key ` -- use the :keyword: `in ` operator
847+ * Removed. :meth: `! dict.has_key ` -- use the :keyword: `in ` operator
848848 instead.
849849
850850.. ======================================================================
0 commit comments