473,805 Members | 1,978 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 1668
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
3186
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
10105
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 except namespace prefixes. The docs mention "proper" output can be achieved by using the Qname object,...
1
3073
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
5433
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 I figured it would be better to include too much than not enough. I basically expected...
30
4635
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 headlong into this aspect of the API while doing some DOM manipulations, and it's got me pretty...
5
9993
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
1516
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
1661
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
3550
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 instead of elementtree. This alone is bad. To make it worse, you have to create an elementtree from...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10607
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10364
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10104
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5541
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
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.