[redland] Iterator support for Python API

Andrew Kuchling akuchlin at mems-exchange.org
Wed Aug 7 12:19:25 BST 2002


Would a patch to add iterator support for Iterator and Stream be
accepted?  This would simplify looping a bit, so instead of:

while not stream.end() :
  model.add_statement(stream.next())

you could write:

for statement in stream:
  model.add_statement(statement)

Iterators are only in Python 2.2, so Python 2.1 support would be lost,
and it'll change the API of the Iterator and Stream classes.  If this
is considered worthwhile, I can provide a patch.

Incidentally, pychecker reports the following warnings for the last
released version of RDF.py.  The ones at line 159 and 174 look like
actual bugs (should be _set_type(value) and librdf_new_uri_from_uri,
perhaps?).

r2.py:36: Imported module (sys) not used
r2.py:37: Imported module (string) not used
r2.py:68: Parameter (digest_name) not used
r2.py:68: Parameter (uri_hash) not used
r2.py:159: Invalid arguments to (_set_type), got 0, expected 1
r2.py:174: No module attribute (librdf_uri_from_uri) found

--amk







More information about the redland-dev mailing list