From ef34d42104b7b207527c4b808855aba40a2263d3 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Tue, 14 May 2013 09:03:16 -0400 Subject: Added warning about using NavigableString outside of Beautiful Soup. --- doc/source/index.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/source') diff --git a/doc/source/index.rst b/doc/source/index.rst index b1cbd21..073fff3 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -455,6 +455,12 @@ them. In particular, since a string can't contain anything (the way a tag may contain a string or another tag), strings don't support the ``.contents`` or ``.string`` attributes, or the ``find()`` method. +If you want to use a ``NavigableString`` outside of Beautiful Soup, +you should call ``unicode()`` on it to turn it into a normal Python +Unicode string. If you don't, your string will carry around a +reference to the entire Beautiful Soup parse tree, even when you're +done using Beautiful Soup. This is a big waste of memory. + ``BeautifulSoup`` ----------------- -- cgit v1.2.3