This will import the accelerated C module if it exists, and the pure Python module otherwise. The cElementTree module is not going to be needed any longer, although it will stay in the standard library as a thin alias, for backwards compatibility.
This wouldn’t be very interesting if ElementTree had been a usual package. In fact, it was one of the very few externally maintained packages in the standard library. Historically, the package was donated to CPython by its maintainer Fredrik Lundh, who kept the copyright. This made the package somewhat challenging to maintain for the Python core developers, since any change had to be coordinated with Fredrik and his up-stream standalone distribution.
Although de-facto the standard library ElementTree already diverged a bit from Fredrik’s implementation (especially due to the great efforts of Florent Xicluna), the change discussed here is at the package’s interface, rather than its implementation, so it raised a lively discussion in the Python core development mailing list. Luckily, Fredrik readily agreed to cede further maintenance of ElementTree to the Python developers, so the copyright/maintenance obstacle disappeared.
Some work remains to further improve ElementTree, and there are a few relevant issues open in the Python bug tracker:
Issue #14006: The ElementTree documentation could use some love.
Issues #14007 and #14128: some mismatches between documentation and implementation.
A few other open issues can be found by searching the tracker for ElementTree
I’m currently focusing on the latter (#14128). Specifically, while the Element class can be subclassed in the Python implementation, it can’t in the C implementation (because there Element is just a factory function for creating new objects). I already have a patch for this attached to the issue, after which I plan to work out the other discrepancies.
Python development is a cooperative effort, and I’m grateful to many other devs for their help in issues related to ElementTree. More help is needed, though! So if you’re thinking of starting contributing to Python, the ElementTree package is a good place to start because there is a lot of remaining work, and it is currently actively in focus of a few core devs so getting meaningful contributions committed should be relatively easy. |