[Python-3000] xml.etree.ElementTree and PEP 8

Stefan Behnel stefan_ml at behnel.de
Sun Aug 10 18:32:23 CEST 2008


Martin v. Löwis wrote:
>> Given the fact that most packages that depend on ET already use more than one
>> try-except import for these modules anyway (and likely a separate module that
>> cares for the right import), I don't see the situation becoming any worse by
>> making them PEP8 compliant.
> 
> So what specific changes would you have in mind? How would existing code
> have to be changed to accommodate these changes?

I was thinking of the existing import cascade below:

http://code.activestate.com/recipes/475126/

There's hardly a way to make *that* worse.

>From looking at the archives, it seems that the original idea to call the
package "xml.etree" came from Fredrik himself - a bad choice, even at the
time, but that's how it is now.

So the obvious suggestion is that in Py3, the modules should be called
"xml.etree.elementtree", "xml.etree.celementtree", etc., and code that imports
them would add yet another try-import-except. I think the rest of the modules
(function names, class names, etc.) is pretty much PEP8 compliant already,
given the freedom that it currently permits. The only thing that really
strikes currently is the identical naming of modules and classes.

Stefan



More information about the Python-3000 mailing list