[Biopython-dev] [RFC, PATCH] Bio.Iter

Jeffrey Chang jchang at jeffchang.com
Thu Sep 11 03:28:37 EDT 2003


CVS is patched.  Thanks!

jeff


On Wednesday, September 10, 2003, at 11:42  AM, Yves Bastide wrote:

> 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
> ---  
> /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
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev




More information about the Biopython-dev mailing list