[Python-checkins] r88155 - python/branches/py3k/Doc/whatsnew/3.2.rst

Nick Coghlan ncoghlan at gmail.com
Tue Jan 25 17:07:45 CET 2011


On Mon, Jan 24, 2011 at 11:51 AM, raymond.hettinger
<python-checkins at python.org> wrote:
> Author: raymond.hettinger
> Date: Mon Jan 24 02:51:49 2011
> New Revision: 88155
>
> Log:
> Add entries for dis, dbm, and ctypes.
>
>
> Modified:
>   python/branches/py3k/Doc/whatsnew/3.2.rst
>
> Modified: python/branches/py3k/Doc/whatsnew/3.2.rst
> ==============================================================================
> --- python/branches/py3k/Doc/whatsnew/3.2.rst   (original)
> +++ python/branches/py3k/Doc/whatsnew/3.2.rst   Mon Jan 24 02:51:49 2011
> @@ -1599,6 +1599,51 @@
>
>  (Contributed by Ron Adam; :issue:`2001`.)
>
> +dis
> +---

For the dis module there is also the change to dis.dis() itself from
issue 6507 - you can now pass source strings directly to dis without
needing to compile them first:

>>> dis.dis("1 + 2")
  1           0 LOAD_CONST               2 (3)
              3 RETURN_VALUE

> +The :mod:`dis` module gained two new functions for inspecting code,
> +:func:`~dis.code_info` and :func:`~dis.show_code`.  Both provide detailed code
> +object information for the supplied function, method, source code string or code
> +object.  The former returns a string and the latter prints it::
> +
> +    >>> import dis, random
> +    >>> show_code(random.choice)

Typo here - missing a "dis." at the start of the line.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-checkins mailing list