The day you thought would never come--a new release in the 3.0.x
series. This is the release series I recommend unless you're using
Python 3.0.
Almost all the code in this release is from Aaron DeVore. I just
packaged it, fixed some bugs, and wrote some unit tests.
You can get the tarball here:
http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.0.8.tar.gz
Leonard
===
From the NEWS file:
New features
------------
Tag.replaceWithChildren()
Replace a tag with its children.
Tag.string assignment
`tag.string = string` replaces the contents of a tag with `string`.
Tag.text property (NOT A FUNCTION!)
tag.text gathers together and joins all text children. Much faster than
"".join(tag.findAll(text=True))
Tag.getText(seperator=u"")
Same as Tag.text, but a function that allows a custom seperator between joined
text elements.
Tag.index(element) -> int
Returns the index of `element` within the tag. Matches the actual
element instead of using __eq__.
Tag.clear()
Remove all child elements.
Improvements
------------
Previously, searching by CSS class only matched tags that had the
requested CSS class and no other classes. Now, searching by CSS class
matches every tag that uses that class.
Performance
-----------
Beware! Although searching the tree is much faster in 3.0.8 than in
previous versions, you probably won't notice the difference in real
situations, because the time spent searching the tree is typically
dwarfed by the time spent parsing the file in the first place.
Tag.decompose() is several times faster.
A very basic findAll(...) is several times faster.
findAll(True) is special cased
Tag.recursiveChildGenerator is much faster