[lxml-dev] 2.1beta questions: objectify.XML, objectify.parse base_url arg, deprecate enableRecursiveStr, etree.tounicode()
jholg at gmx.de
jholg at gmx.de
Wed Jul 2 09:30:36 CEST 2008
Hi Stefan,
> It would also require a bit more parameter checking and exception
> raising. The
> unicode option and the encoding are mutually exclusive, and unicode is
> not so
> far from an encoding that it would really merit an option on its own.
>
> Note also that you do not pass "Unicode" as a string but the unicode
> type, and
> you get a unicode object back.
>
>
>
I took the liberty to modify the documentation a tiny little bit to
reward this behaviour:
$ svn diff -rPREV doc/parsing.txt
Index: doc/parsing.txt
===================================================================
--- doc/parsing.txt (revision 56229)
+++ doc/parsing.txt (working copy)
@@ -675,8 +675,8 @@
>>> etree.tostring(root, encoding='UTF-8', xml_declaration=False)
b'<test> \xef\xa3\x91 + \xef\xa3\x92 </test>'
-As an extension, lxml.etree recognises the unicode type as encoding to
-build a Python unicode representation of a tree:
+As an extension, lxml.etree recognises the unicode type as an argument to
the
+encoding parameter to build a Python unicode representation of a tree:
.. sourcecode:: pycon
I think this subtly documents that unicode is not an encoding, strictly
speaking.
Holger
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20080702/8aa6515c/attachment-0001.htm
More information about the lxml-dev
mailing list