~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Doc/whatsnew/2.7.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1952
1952
version 1.3.  Some of the new features are:
1953
1953
 
1954
1954
* The various parsing functions now take a *parser* keyword argument
1955
 
  giving an :class:`XMLParser` instance that will
 
1955
  giving an :class:`~xml.etree.ElementTree.XMLParser` instance that will
1956
1956
  be used.  This makes it possible to override the file's internal encoding::
1957
1957
 
1958
1958
    p = ET.XMLParser(encoding='utf-8')
1964
1964
 
1965
1965
* ElementTree's code for converting trees to a string has been
1966
1966
  significantly reworked, making it roughly twice as fast in many
1967
 
  cases.  The :class:`ElementTree` :meth:`write` and :class:`Element`
1968
 
  :meth:`write` methods now have a *method* parameter that can be
 
1967
  cases.  The :meth:`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>`
 
1968
  and :meth:`Element.write` methods now have a *method* parameter that can be
1969
1969
  "xml" (the default), "html", or "text".  HTML mode will output empty
1970
1970
  elements as ``<empty></empty>`` instead of ``<empty/>``, and text
1971
1971
  mode will skip over elements and only output the text chunks.  If
1978
1978
  declarations are now output on the root element, not scattered throughout
1979
1979
  the resulting XML.  You can set the default namespace for a tree
1980
1980
  by setting the :attr:`default_namespace` attribute and can
1981
 
  register new prefixes with :meth:`register_namespace`.  In XML mode,
 
1981
  register new prefixes with :meth:`~xml.etree.ElementTree.register_namespace`.  In XML mode,
1982
1982
  you can use the true/false *xml_declaration* parameter to suppress the
1983
1983
  XML declaration.
1984
1984
 
1985
 
* New :class:`Element` method: :meth:`extend` appends the items from a
 
1985
* New :class:`~xml.etree.ElementTree.Element` method:
 
1986
  :meth:`~xml.etree.ElementTree.Element.extend` appends the items from a
1986
1987
  sequence to the element's children.  Elements themselves behave like
1987
1988
  sequences, so it's easy to move children from one element to
1988
1989
  another::
1998
1999
    # Outputs <root><item>1</item>...</root>
1999
2000
    print ET.tostring(new)
2000
2001
 
2001
 
* New :class:`Element` method: :meth:`iter` yields the children of the
 
2002
* New :class:`Element` method:
 
2003
  :meth:`~xml.etree.ElementTree.Element.iter` yields the children of the
2002
2004
  element as a generator.  It's also possible to write ``for child in
2003
2005
  elem:`` to loop over an element's children.  The existing method
2004
2006
  :meth:`getiterator` is now deprecated, as is :meth:`getchildren`
2005
2007
  which constructs and returns a list of children.
2006
2008
 
2007
 
* New :class:`Element` method: :meth:`itertext` yields all chunks of
 
2009
* New :class:`Element` method:
 
2010
  :meth:`~xml.etree.ElementTree.Element.itertext` yields all chunks of
2008
2011
  text that are descendants of the element.  For example::
2009
2012
 
2010
2013
    t = ET.XML("""<list>