Re: [Python-Dev] elementtree in stdlib

2006-04-08 Thread Greg Ewing
Georg Brandl wrote: Suppose I wanted to implement that, what would be the best strategy to follow: - change handling of IMPORT_NAME and IMPORT_FROM in ceval.c - emit different bytecodes in compile.c - directly create TryExcept AST nodes in ast.c I'd probably go for the third option. Isn't

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Giovanni Bajo
Greg Ewing [EMAIL PROTECTED] wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseam For situations like this I've thought it might be handy to be able to say import xml.etree.ElementTree or cElementTree or \

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Thomas Wouters
On 4/7/06, Greg Ewing [EMAIL PROTECTED] wrote: Trent Mick wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseamFor situations like this I've thought it might be handy to be able to say import xml.etree.ElementTree or cElementTree or \

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Georg Brandl
Greg Ewing wrote: Trent Mick wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseam For situations like this I've thought it might be handy to be able to say import xml.etree.ElementTree or cElementTree or \

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Nick Coghlan
Georg Brandl wrote: Greg Ewing wrote: Trent Mick wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseam For situations like this I've thought it might be handy to be able to say import xml.etree.ElementTree or

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Martin Blais
On 4/6/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Bob Ippolito wrote: Try the 2.5 alpha 1 just released, and you'll see that the toplevel package is now xml.etree. The module and class are still called ElementTree, though. It would be nice to have new code be PEP 8 compliant..

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Trent Mick
[Thomas Wouters suggested import ... or syntax] or is that all going too far? :) Yes. It is overkill. The number of different ways to import ElementTree is perhaps unfortunate but it is a mostly isolated incident: effbot providing pure and c versions, it being popular and hence having other

Re: [Python-Dev] elementtree in stdlib

2006-04-07 Thread Georg Brandl
Nick Coghlan wrote: Georg Brandl wrote: Greg Ewing wrote: Trent Mick wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseam For situations like this I've thought it might be handy to be able to say import

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Greg Ewing
Fredrik Lundh wrote: it's not new code, and having *different* module names for the same well-established library isn't very nice to anyone. Modules should have short, lowercase names, without underscores. But if we don't start becoming stricter about the naming of things added to the

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Aahz
On Thu, Apr 06, 2006, Greg Ewing wrote: Fredrik Lundh wrote: it's not new code, and having *different* module names for the same well-established library isn't very nice to anyone. Modules should have short, lowercase names, without underscores. But if we don't start becoming stricter

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Martijn Faassen
Alex Martelli wrote: On Apr 5, 2006, at 8:30 PM, Greg Ewing wrote: A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be reorganised a bit. I've just

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Trent Mick
[Martijn Faassen wrote] I.e., this in ElementTree: ... http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475126 import ElementTree from everywhere try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: try: import cElementTree as

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Fredrik Lundh
Trent Mick wrote: That is the current state. which reminds that maybe it's time to add an import helper to the standard library, so you can do stringio = import_search(cStringIO, StringIO) ET = import_search(lxml.etree, cElementTree, xml.etree.cElementTree) db =

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Trent Mick
[Fredrik Lundh wrote] Trent Mick wrote: That is the current state. which reminds that maybe it's time to add an import helper to the standard library, so you can do stringio = import_search(cStringIO, StringIO) ET = import_search(lxml.etree, cElementTree,

Re: [Python-Dev] elementtree in stdlib

2006-04-06 Thread Greg Ewing
Trent Mick wrote: try: import xml.etree.ElementTree as ET # in python =2.5 except ImportError: ... etc ad nauseam For situations like this I've thought it might be handy to be able to say import xml.etree.ElementTree or cElementTree or \

[Python-Dev] elementtree in stdlib

2006-04-05 Thread Greg Ewing
A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be reorganised a bit. I've just started playing with it, and having a package called elementtree containing a

Re: [Python-Dev] elementtree in stdlib

2006-04-05 Thread Alex Martelli
On Apr 5, 2006, at 8:30 PM, Greg Ewing wrote: A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be reorganised a bit. I've just started playing with it,

Re: [Python-Dev] elementtree in stdlib

2006-04-05 Thread Bob Ippolito
On Apr 5, 2006, at 9:02 PM, Alex Martelli wrote: On Apr 5, 2006, at 8:30 PM, Greg Ewing wrote: A while ago there was some discussion about including elementtree in the std lib. I can't remember what the conclusion about that was, but if it does go ahead, I'd like to suggest that it be

Re: [Python-Dev] elementtree in stdlib

2006-04-05 Thread Fredrik Lundh
Bob Ippolito wrote: Try the 2.5 alpha 1 just released, and you'll see that the toplevel package is now xml.etree. The module and class are still called ElementTree, though. It would be nice to have new code be PEP 8 compliant.. it's not new code, and having *different* module names for

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Walter Dörwald
Guido van Rossum wrote: On 12/13/05, Walter Dörwald [EMAIL PROTECTED] wrote: Guido van Rossum wrote: I don't think that SAX is unpythonic, but it's pretty low-level and mostly of use to people writing higher-level XML parsers (my parsexml module uses it). Having to define classes that

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread M.-A. Lemburg
Fredrik Lundh wrote: M.-A. Lemburg wrote: Some questions: * Are you going to contribute cElementTree as well ? yes, but there are some build issues we need to sort out first (both pyexpat and cET link to their own copies of expat) Great ! we also need to figure out how to import the

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Jason Orendorff
Guido van Rossum wrote: On 12/13/05, Walter Dörwald [EMAIL PROTECTED] wrote: Having to define classes that conform to a certain API and registering instances of those classes as callbacks with the parser doesn't look that pythonic to me. An iterator API seems much more pythonic. Perhaps.

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Jeremy Hylton
On 12/14/05, M.-A. Lemburg [EMAIL PROTECTED] wrote: we also need to figure out how to import the bundled version; should it be cElementTree, xml.etree.cElementTree, or just xml.etree.ElementTree (which would then fallback on the Python version if cElementTree isn't built) ? If the

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Ian Bicking
M.-A. Lemburg wrote: we also need to figure out how to import the bundled version; should it be cElementTree, xml.etree.cElementTree, or just xml.etree.ElementTree (which would then fallback on the Python version if cElementTree isn't built) ? If the semantics are identical I'd prefer the

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Fred L. Drake, Jr.
On Wednesday 14 December 2005 12:39, Ian Bicking wrote: I have myself in the past used or overridden non-public methods of ElementTree, which I'm sure wouldn't work with cElementTree. While I'd also prefer automatic fallback, it would be nice if there was additionally an explicit path to

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Michael Chermside
/F writes: it's cStringIO vs. StringIO and cPickle vs. pickle situation again; the modules are 99% compatible, but there's always someone that relies on that last % (which is a result of ET being written in Python). Yes! at this point, I think it's more important to guarantee that changing

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Brett Cannon
On 12/14/05, Michael Chermside [EMAIL PROTECTED] wrote: /F writes: it's cStringIO vs. StringIO and cPickle vs. pickle situation again; the modules are 99% compatible, but there's always someone that relies on that last % (which is a result of ET being written in Python). Yes! at this

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Scott David Daniels
Michael Chermside wrote: ... a meme will spread which says (and PLEASE don't quote this!) ElementTree has a great API, but it's just too slow for real work. +1 DNQOTW :-) (Do Not Quote Of The Week) --Scott David Daniels [EMAIL PROTECTED] ___

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Brett Cannon
On 12/14/05, Phillip J. Eby [EMAIL PROTECTED] wrote: At 01:16 PM 12/14/2005 -0800, Brett Cannon wrote: On 12/14/05, Michael Chermside [EMAIL PROTECTED] wrote: We already know that Python is particularly susceptable to too slow memes, even invalid ones. I think the best all-around solution

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Walter Dörwald
Guido van Rossum wrote: On 12/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Martin It's difficult to establish precise numbers, but I would expect Martin that most readers of xml-sig are well aware of how DOM and SAX Martin work, perhaps even better than ElementTree. Perhaps

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Walter Dörwald
Martin v. Löwis wrote: [...] It's difficult to establish precise numbers, but I would expect that most readers of xml-sig are well aware of how DOM and SAX work, perhaps even better than ElementTree. My main complaint about this was in the past that it is a Python-only solution, so

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Nick Coghlan
Walter Dörwald wrote: Having to define classes that conform to a certain API and registering instances of those classes as callbacks with the parser doesn't look that pythonic to me. An iterator API seems much more pythonic. If this is a comment on the ElementTree API, then /F must agree

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Fredrik Lundh
M.-A. Lemburg wrote: Some questions: * Are you going to contribute cElementTree as well ? yes, but there are some build issues we need to sort out first (both pyexpat and cET link to their own copies of expat) we also need to figure out how to import the bundled version; should it be

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Jason Orendorff
On 12/13/05, Walter Dörwald [EMAIL PROTECTED] wrote: Guido van Rossum wrote: I don't think that SAX is unpythonic, but it's pretty low-level and mostly of use to people writing higher-level XML parsers (my parsexml module uses it). Having to define classes that conform to a certain API

[Python-Dev] ElementTree in stdlib

2005-12-12 Thread Mike Brown
Catching up on some python-dev email, I was surprised to see that things seem to be barrelling ahead with the adding of ElementTree to Python core without any discussion on XML-SIG. Sidestepping XML-SIG and the proving grounds of PyXML in order to satsify the demand for a Pythonic

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Martin v. Löwis
Steven Bethard wrote: I didn't really feel like the proposal was out of the blue. The proposal has been brought up before, both on python-dev[1] and the python-list[2]. ElementTree has a pretty large following - if you look at XML-based questions on the python-list, I can almost guarantee

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Martin v. Löwis
Mike Brown wrote: Catching up on some python-dev email, I was surprised to see that things seem to be barrelling ahead with the adding of ElementTree to Python core without any discussion on XML-SIG. Sidestepping XML-SIG and the proving grounds of PyXML in order to satsify the demand for a

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Steven Bethard
Martin v. Löwis wrote: Steven Bethard wrote: I didn't really feel like the proposal was out of the blue. The proposal has been brought up before, both on python-dev[1] and the python-list[2]. ElementTree has a pretty large following - if you look at XML-based questions on the

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Raymond Hettinger
The single nomination actually triggered a (admittedly fast) process, where multiple people spoke in favour, not just a single one. It also followed a discussion on python-list. Also, there were silent +1 votes from people like me who followed all the posts and saw no need to alter the

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Mike Brown
Martin v. L So as that has more-or-less failed, the next natural approach is let's believe in the community. For that, two things need to happen: the author of the package must indicate that he would like to see it incorporated, and the users must indicate that they like the package. Both has

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Phillip J. Eby
At 06:19 PM 12/12/2005 -0700, Mike Brown wrote: Some authors of other libs may not even be aware that they could so easily have their code whisked into stdlib, if it's solid enough. But here the definition of solid enough includes such credits as being written by the primary author of CPython's

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread skip
Martin It's difficult to establish precise numbers, but I would expect Martin that most readers of xml-sig are well aware of how DOM and SAX Martin work, perhaps even better than ElementTree. Perhaps the corollary is that people who are not xml-sig readers will likely be put off by

Re: [Python-Dev] ElementTree in stdlib

2005-12-12 Thread Guido van Rossum
On 12/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Martin It's difficult to establish precise numbers, but I would expect Martin that most readers of xml-sig are well aware of how DOM and SAX Martin work, perhaps even better than ElementTree. Perhaps the corollary is that