[MERGE] file-object based container format
Johan Rydberg
jrydberg at gnu.org
Mon Jul 2 17:13:59 BST 2007
Aaron Bentley <aaron.bentley at utoronto.ca> writes:
> Hi all,
Hi Aaron,
> + def iter_records(self):
> + """Iterate over the container, yielding each record as it is read.
> +
> + Each yielded record will be a 2-tuple of (names, callable), where names
> + is a ``list`` and bytes is a function that takes one argument,
> + ``max_length``.
> +
> + You **must not** call the callable after advancing the interator to the
> + next record. That is, this code is invalid::
> +
> + record_iter = container.iter_records()
> + names1, callable1 = record_iter.next()
> + names2, callable2 = record_iter.next()
> + bytes1 = callable1(None)
> +
> + As it will give incorrect results and invalidate the state of the
> + ContainerReader.
> +
> + :raises ContainerError: if any sort of containter corruption is
> + detected, e.g. UnknownContainerFormatError is the format of the
> + container is unrecognised.
> + :seealso: ContainerReader.read
> + """
> + self._read_format()
> + return self._iter_records()
I must say I would prefer (for esthetic reasons) if iter_records
returned an (file-like?) object that has a read-method, instead of a
callable. Much like John suggested.
Just my two not so relevant two cents.
~j
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070702/b78132ff/attachment.pgp
More information about the bazaar
mailing list