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

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

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 im

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

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 >> >>impor

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 cEl

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

Re: [Python-Dev] elementtree in stdlib

2006-04-06 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 cElem

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 \ elementtree.Eleme

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", "xml

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 = import_se

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

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

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 becomi

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-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 nam

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

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 wit

[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

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-ar

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] ___ Pyt

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Phillip J. Eby
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 is to > > include cElementTree and use it whereve

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! >

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 changin

Re: [Python-Dev] ElementTree in stdlib

2005-12-14 Thread Fredrik Lundh
Jeremy Hylton wrote: > 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 cElement

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

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 pref

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

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. > >

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 i

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 cla

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 cert

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Michael Chermside
I wrote: > Frankly, if at any time in the past several years the XML-SIG had > published their consensus report on the "preferred API for XML" > (or perhaps "preferred small set of APIs, each tuned for a specific > purpose"), I expect it would have been incorporated in the core. Martin v. Löwis ob

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Fredrik Lundh
Fred wrote: > > That's not true. The current xml package *is* the consensus of > > xml-sig. > > It pretty much was at the time, at any rate. It's not clear to me that the > xml package shipped in 2.4 and several preceeding versions of Python would > pass muster in the current XML-SIG. There's be

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Fred L. Drake, Jr.
On Tuesday 13 December 2005 15:02, Martin v. Löwis wrote: > That's not true. The current xml package *is* the consensus of > xml-sig. It pretty much was at the time, at any rate. It's not clear to me that the xml package shipped in 2.4 and several preceeding versions of Python would pass must

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Martin v. Löwis
Michael Chermside wrote: > Frankly, if at any time in the past several years the XML-SIG had > published their consensus report on the "preferred API for XML" > (or perhaps "preferred small set of APIs, each tuned for a specific > purpose"), I expect it would have been incorporated in the core. > T

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Guido van Rossum
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 cert

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Michael Chermside
Mike Brown writes: [ElementTree was accepted into stdlib immediately without discussion on XML-Sig. Seems like a lack of due process.] > 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. It's not the solid

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 cElem

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread M.-A. Lemburg
Nice that we now have ElementTree in the stdlib :-) Some questions: * Are you going to contribute cElementTree as well ? * What was the motivation to not include the whole ElementTree package ? * I'm missing the usual "Licensed to PSF under a Contributor Agreement." in the copyright notices

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Fredrik Lundh
Nick Coghlan 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 a

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 w

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,

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

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Steve Holden
Phillip J. Eby wrote: > 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 > wr

Re: [Python-Dev] ElementTree in stdlib

2005-12-13 Thread Martin v. Löwis
Mike Brown wrote: > My fears are just that 1. XML-SIG is being seen as either irrelevant or as an > obstacle (perhaps due to the friction between Fredrik and Uche) and are thus > being sidestepped, and 2. other libs that could/should be contenders (Amara > and 4Suite are not in this list, by the

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

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 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

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. Bo

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 direc

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 py

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

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 Steven Bethard
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 Guido van Rossum
I'm not so surprised that Fredrik chose to bypass XML-SIG. There doesn't seem to be a lot of decision power there -- in fact it feels a bit dead, with a weird mix of too-high-level discussions that don't go anywhere, plus basic beginner's Q+A. Also, it would seem that /F's ElementTree doesn't need

[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 databinding+AP