[Python-Dev] folding cElementTree behind ElementTree in 3.3

Antoine Pitrou solipsis at pitrou.net
Thu Feb 16 18:55:54 CET 2012


On Thu, 16 Feb 2012 19:32:24 +0200
Ezio Melotti <ezio.melotti at gmail.com> wrote:
> 
> If I'm writing code that imports cElementTree on 3.3+, and I explicitly 
> turn on DeprecationWarnings (that would otherwise be silenced) to check 
> if I'm doing something wrong, I would like Python to tell me "You don't 
> need to import that anymore, just use ElementTree.".
> If I'm also converting all the warnings to errors, it's probably because 
> I really want my code to do the right thing and spending 1 minute to 
> add/change two line of code to fix this won't probably bother me too much.

But then you're going from a cumbersome situation (where you have to
import cElementTree and then fallback on regular ElementTree) to an
even more cumbersome one (where you have to first check the Python
version, then conditionally import cElementTree, then fallback on
regular ElementTree).

> >> And, of course, even people that *don't* convert warnings to errors
> >> when running tests will have to make the same switch when the module
> >> is eventually removed.
> 
> When the module is eventually removed and you didn't warn them in 
> advance, the situation is going to turn much worse, because their code 
> will suddenly stop working once they upgrade to the newer version.

Why would we remove the module? It seems "supporting" it should be
mostly trivial (it's an alias).

> I would watch this from the opposite point of view.  Why should the 
> other Python implementation have a to keep around a dummy module due to 
> a CPython implementation detail?

I don't know, but they already have this module, and it certainly costs
them nothing to keep it.

Regards

Antoine.




More information about the Python-Dev mailing list