[RFC] bzr.jrydberg.versionedfile

John Arbash Meinel john at arbash-meinel.com
Wed Dec 21 16:40:58 GMT 2005


Jan Hudec wrote:
> On Wed, Dec 21, 2005 at 10:19:41 -0600, John Arbash Meinel wrote:
> 
>>Well if we make the contract such that it returns an iterator, in the
>>future you could change the implementation so that it wouldn't have to
>>read the entire file before it returns text.
>>I don't know if this would lead to any improvement. Or if it just means
>>that most of the callers will start using:
>>
>>text = list(get_text())
>>Which makes things worse instead of better.
> 
> 
> When would you do that? For most purposes I can think of, iterator and list
> behave the same enough.
> 

If you ever want to just grab a subset, (text[10:20]), or if you need to
iterate twice:

for line in text:
	# do stuff

for line in text:
	# Check again

I don't know that it will actually be used that way. I just wanted to
bring up the fact that it *might*.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051221/a907a7b3/attachment.pgp 


More information about the bazaar mailing list