~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Doc/library/future_builtins.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
.. versionadded:: 2.6
7
7
 
8
8
This module provides functions that exist in 2.x, but have different behavior in
9
 
Python 3, so they cannot be put into the 2.x builtin namespace.
 
9
Python 3, so they cannot be put into the 2.x builtins namespace.
10
10
 
11
11
Instead, if you want to write code compatible with Python 3 builtins, import
12
12
them from this module, like this::
42
42
 
43
43
.. function:: hex(object)
44
44
 
45
 
   Works like the builtin :func:`hex`, but instead of :meth:`__hex__` it will
 
45
   Works like the built-in :func:`hex`, but instead of :meth:`__hex__` it will
46
46
   use the :meth:`__index__` method on its argument to get an integer that is
47
47
   then converted to hexadecimal.
48
48
 
52
52
 
53
53
.. function:: oct(object)
54
54
 
55
 
   Works like the builtin :func:`oct`, but instead of :meth:`__oct__` it will
 
55
   Works like the built-in :func:`oct`, but instead of :meth:`__oct__` it will
56
56
   use the :meth:`__index__` method on its argument to get an integer that is
57
57
   then converted to octal.
58
58