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

Brett Cannon brett at python.org
Sun Aug 10 20:23:56 CEST 2008


On Sun, Aug 10, 2008 at 9:32 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> 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.
>

Actually, if this rename ever happened the C version would be hidden
behind ElementTree as an implementation detail.

And one of the reasons this didn't happen was that ElementTree is a
third-party module, so it was a question of whether to break from that
or not. As Martin said, some people (including me) would like to see
this change, but there were other battles to be fought for renames.

-Brett


More information about the Python-3000 mailing list