[XML-SIG] Deep copy of an element from one document to another
Uche Ogbuji
uche.ogbuji@fourthought.com
19 Jun 2002 09:08:14 -0600
On Wed, 2002-06-19 at 09:03, Fred L. Drake, Jr. wrote:
>
> Uche Ogbuji writes:
> > I like this idea, except iterators are 2.2 only. I suppose the
> > __iter__ function would be harmless in an older version, but it
> > puts the onus on the user to write his code portably, probably
> > restoring the verbosity the iterator would have minimized.
>
> Regarding the iterator: it's worse than that, though: I used the
> "yield" keyword, which will cause a SyntaxError in Python 2.1.x and
> earlier. That might be a problem for some people, and is more tedious
> to work around. ;-(
Yes. At least iterators don't introduce new syntax. I ran into the
generator problem a few weeks back when I tried to introduce more
efficient DOM iterator code. No way to make a condition around a new
keyword. I even tried fiddling with distutils so that it would install
one file if Python 2.2 was installed, and another for older versions,
but this was too much of a terror. Before I gave up, I considered a
hack that would probably work, but was too ugly for contemplation:
exec("yield")
I decided against this :-)
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Track chair, XML/Web Services One (San Jose, Boston):
http://www.xmlconference.com/
DAML Reference - http://www.xml.com/pub/a/2002/05/01/damlref.html
The Languages of the Semantic Web -
http://www.newarchitectmag.com/documents/s=2453/new1020218556549/index.html
XML, The Model Driven Architecture, and RDF @ XML Europe -
http://www.xmleurope.com/2002/kttrack.asp#themodel