[Biopython-dev] [RFC, PATCH] Bio.Iter
Yves Bastide
Yves.Bastide at irisa.fr
Wed Sep 10 14:42:33 EDT 2003
Jeffrey Chang wrote:
> Hi Yves,
>
> Does this not do the same thing?
> b_iterator = iter(NCBIStandalone.Iterator(blast_out, b_parser).next,
> None)
Yep -- but I posted my message before thinking about it :)
>
> It's a little uglier than your solution. However, the best would be to
> make NCBIStandalone.Iterator a true iterator. Could you also try
> adding, to the NCBIStandalone.Iterator class the method:
>
> def __iter__(self):
> return iter(self.next, None)
>
> I have not tested it. However, if it works correctly for you, please
> let me know and I can add it to the distribution.
It does. Thanks!
>
> Jeff
>
>
>
-------------- next part --------------
--- /local/lib/python2.2/site-packages/Bio/Blast/NCBIStandalone.py 2003-09-03 10:19:40.000000000 +0200
+++ Bio/Blast/NCBIStandalone.py 2003-09-10 20:34:10.000000000 +0200
@@ -33,6 +33,7 @@ blastpgp Execute blastpgp.
"""
+from __future__ import generators
import os
import re
@@ -1331,6 +1332,9 @@ class Iterator:
return self._parser.parse(File.StringHandle(data))
return data
+ def __iter__(self):
+ return iter(self.next, None)
+
def blastall(blastcmd, program, database, infile, **keywds):
"""blastall(blastcmd, program, database, infile, **keywds) ->
read, error Undohandles
More information about the Biopython-dev
mailing list