473,573 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ElementTree - Why not part of the core?

Why is the ElementTree API not a part of the Python core?
I've recently been developing a script for accessing the Miva API only
to find all the core API's provided by Python for parsing XML is messy
and complicated. Many of the examples I see for parsing the data using
these API's uses a similar additional Class for collapsing the XML data
into a more manageable format.
This is clearly not following the Python-way of clean, simple code and
easy development.

ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way. Why has the API not been
included in the Python core?

Dec 7 '05 #1
28 1646
Doug,

I agree with you, ElementTree is fast & pythonic.
Certainly does make sense to me.

Dec 7 '05 #2
do**********@gm ail.com wrote:
ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way. Why has the API not been
included in the Python core?


While I fully agree that ElementTree is far more Pythonic than the
dom-based stuff in the core, this issue has been discussed on
python-dev[1]. Fredrik Lundh's response:

shipping stable versions of ElementTree/cElementTree (or PIL, or
python-doc, or exemaker, or what else you might find useful) with
official Python releases is perfectly okay.

moving the main trunk and main development over to the Python CVS is
another thing, entirely.

I think some people were hoping that instead of adding these things to
the standard library, we would come up with a better package manager
that would make adding these things to your local library much simpler.

STeVe

[1]http://www.python.org/dev/summary/2005-06-01_2005-06-15.html#reorgan ising-the-standard-library-again
Dec 7 '05 #3
Steven Bethard napisa³(a):
ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way. Why has the API not been
included in the Python core?


While I fully agree that ElementTree is far more Pythonic than the
dom-based stuff in the core, this issue has been discussed on
python-dev[1]. Fredrik Lundh's response:

shipping stable versions of ElementTree/cElementTree (or PIL, or
python-doc, or exemaker, or what else you might find useful) with
official Python releases is perfectly okay.

moving the main trunk and main development over to the Python CVS is
another thing, entirely.

I think some people were hoping that instead of adding these things to
the standard library, we would come up with a better package manager
that would make adding these things to your local library much simpler.


What about more intelligent installer, that after installing core
packages, would present user a list of recommended packages in few
groups (like "markup processing", "popular RDBMS interaction", "web
frameworks", "multimedia ", etc.) and would be able to fetch and install
packages using PyPI descriptions? Unattended install with this feature
would be great.

--
Jarek Zgoda
http://jpa.berlios.de/
Dec 7 '05 #4
Steven Bethard wrote:
ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way. Why has the API not been
included in the Python core?


While I fully agree that ElementTree is far more Pythonic than the
dom-based stuff in the core, this issue has been discussed on
python-dev[1]. Fredrik Lundh's response:

shipping stable versions of ElementTree/cElementTree (or PIL, or
python-doc, or exemaker, or what else you might find useful) with
official Python releases is perfectly okay.

moving the main trunk and main development over to the Python CVS is
another thing, entirely.

I think some people were hoping that instead of adding these things to
the standard library, we would come up with a better package manager
that would make adding these things to your local library much simpler.


I still hope that the standard distribution will, in a not too distant future,
bundle more external libraries. as things are today, "including something
in the core" means that you have to transfer code and rights to the PSF.

as I've said many times, if the Linux folks can build distributions that con-
sists of thousands of individually maintained pieces, the Python distributors
should be able to handle a few dozen components.

</F>

Dec 7 '05 #5
Before that can happen we'll need some better management of co-existing
different versions of a package. You'll want to be able to use newer
versions of external packages without breakage in the standard library.

Dec 7 '05 #6

Steven Bethard wrote:
--snip--
I think some people were hoping that instead of adding these things to
the standard library, we would come up with a better package manager
that would make adding these things to your local library much simpler.

STeVe

[1]http://www.python.org/dev/summary/2005-06-01_2005-06-15.html#reorgan ising-the-standard-library-again


A better package manager would be great but does not
replace having things in the core. Distributed code that
relies on external packages puts a significantly greater
burden on the user of the code. I suppose there are
ways to get around it but often it means at a minimum
the user will need to read the install instructions (which
seems to be asking a lot for some people.) And at some
companies, one has to jump though beauracratic hoops
for each external package installed. And I personally
stear away from packages that have a long list of
prerequisites.

With things I've written that I thought might be used
by others, I've gone to some lengths to use only modules
in the standard library.

Dec 7 '05 #7
"Fredrik Lundh" <fr*****@python ware.com> writes:
as I've said many times, if the Linux folks can build distributions that con-
sists of thousands of individually maintained pieces, the Python distributors
should be able to handle a few dozen components.


Yes, but "distribute rs" is not necessarily "maintainer s". How many
components are there in the Activestate Python distribution?
Enthoughts? Others?

The maintainers of Linux/gcc/etc. don't worry about creating a
distribution that includes lots of third party software. Why should
the maintainers of Python be any different?

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Dec 7 '05 #8
<ru***@yahoo.co m> wrote:
...
seems to be asking a lot for some people.) And at some
companies, one has to jump though beauracratic hoops
for each external package installed. And I personally
stear away from packages that have a long list of
prerequisites.


Funny -- me, I prefer to steer away from companies with lots of
bureaucracy, instead!-)
Alex
Dec 8 '05 #9
do**********@gm ail.com wrote:
ElementTree on the other hand provides incredibly easy access to XML
elements and works in a more Pythonic way. Why has the API not been
included in the Python core?


I'd really like to see that too. Sure, it's fairly trivial to install
it, but each different package that needs to be installed from another
source, built and tested on multiple platforms etc, means more work.
For complex software systems, these kinds of configuration issues
take a lot of efforts.

We're deploying our software on a number of different platforms. We
certainly depend on Python, so a standard Python install will always
be included. Using standard library modules is for free. Using yet
another third party library has a cost, even if some Cheese Shop or
whatever might make the cost slightly lower.

We have very friendly configuration management guys here, so if I
insisted, I'm sure they'd let me have elementTree included, but I
hesitate to ask for it. It does add a burden on CM, increases the
risk that a deployment will fail, and from a code maintenance point
of view, it's a double edged sword: On one hand, it's a much better
API, but on the other hand, it's not documented in the standard
Python docs or in the Nutshell book, and a new developer would need
to figure out what this foreign beast was, and where to find docs.
(Alternatively, I'd have to (God forbid) document my actions. ;)
Dec 8 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3169
by: Damjan | last post by:
Given the folowing XML snippet, I build an ElementTree instance with et=ElementTree.fromstring(..). Now et.text returns just '\n text\n some other text'. Is there any way I could get everything between the <div> and </div> tag? <div> text some other text<br/> and then some more </div>
9
10073
by: Chris Spencer | last post by:
Does anyone know how to make ElementTree preserve namespace prefixes in parsed xml files? The default behavior is to strip a document of all prefixes and then replace them autogenerated prefixes like ns0, ns1, etc. The correct behavior should be to write the file in the form that it was read, which it seems to do correctly for everything...
1
3052
by: mirandacascade | last post by:
O/S: Windows 2K Vsn of Python: 2.4 Currently: 1) Folder structure: \workarea\ <- ElementTree files reside here \xml\ \dom\
15
5406
by: Steven Bethard | last post by:
I'm having trouble using elementtree with an XML file that has some gbk-encoded text. (I can't read Chinese, so I'm taking their word for it that it's gbk-encoded.) I always have trouble with encodings, so I'm sure I'm just screwing something simple up. Can anyone help me? Here's the interactive session. Sorry it's a little verbose, but...
30
4600
by: Chas Emerick | last post by:
I looked around for an ElementTree-specific mailing list, but found none -- my apologies if this is too broad a forum for this question. I've been using the lxml variant of the ElementTree API, which I understand works in much the same way (with some significant additions). In particular, it shares the use of a .tail attribute. I ran...
5
9978
by: saif.shakeel | last post by:
#!/usr/bin/env python from elementtree import ElementTree as Element tree = et.parse("testxml.xml") for t in tree.getiterator("SERVICEPARAMETER"): if t.get("Semantics") == "localId": t.set("Semantics", "dataPackageID")
0
1496
by: sndive | last post by:
I have a weid problem. If i do this: import elementtree.ElementTree as ET .... tree = ET.parse("whatever") root = tree.getroot() r = root.find('last') print r return root where last is not an immediate child of root node i get back None. However if i comment the r = root.find('last')
2
1652
Zver
by: Zver | last post by:
Hey All! I'm developing application that uses ElementTree for XML parsing. In python 2.5 ElementTree is part of standard "libs". Now my question is. How would you detect version of python and then include the right ElementTree. Psevdo-code :) -> If python version < 2.4 then import elementtree.ElementTree as et
11
3510
by: Peter Pei | last post by:
One bad design about elementtree is that it has different ways parsing a string and a file, even worse they return different objects: 1) When you parse a file, you can simply call parse, which returns a elementtree, on which you can then apply xpath; 2) To parse a string (xml section), you can call XML or fromstring, but both return element...
0
7668
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7986
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8179
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6358
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3701
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3699
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.