[Biopython-dev] Usage of deprecated function apply()
Jeffrey Chang
jchang at jeffchang.com
Thu Sep 4 15:28:52 EDT 2003
I have applied this patch against the CVS. Code running python2.3
should get a speedup. Nothing appears to have been broken, but please
send mail to this list if anyone sees any strange behavior.
Jeff
On Tuesday, September 2, 2003, at 09:45 AM, Peter Slickers wrote:
> Since python2.3 the buildin function aplly() is deprecated.
> Code using apply() is still running under python2.3, but the
> performance is reduced due to calls into python's warn() function.
> For example, the blast parser runs only at half speed under
> python2.3. Moreover, any code using apply() will NOT be
> executable under python2.4.
>
> I suggest to remove an usage of apply() from biopython.
> According to the python manual, the apply function should
> be replaced by the 'extended call synthax'. The extended call
> synthax was introduced in python2.0. Therefore, it is save
> to drop the apply() fucntion, since nowadays at least
> python2.2 is required to run biopython.
>
> Here are some examples of how to replace apply():
>
> - obj = apply(klass, (), kwargs)
> + obj = klass( *(), **kwargs)
>
> - self.this = apply(_KDTreec.new_KDTree,args)
> + self.this = _KDTreec.new_KDTree(*args)
>
> - reader = apply(self.make_footer_reader,
> - (self.fileobj,) + self.footer_args,
> - {"lookahead": self._lookahead})
> + reader = self.make_footer_reader(
> + *(self.fileobj,) + self.footer_args,
> + **{"lookahead": self._lookahead})
>
>
> Today, Tue 02-sep-2003, I have scanned the cvs and found
> 19 file which make use of apply(). Here is a list of the
> affected files:
>
> Bio/EUtils/POM.py
> Bio/EUtils/tests/unittest.py
> Bio/FilteredReader.py
> Bio/KDTree/_KDTree.py
> Bio/Prosite/Pattern.py
> Bio/RecordFile.py
> Bio/SGMLExtractor.py
> Bio/Seq.py
> Bio/SeqUtils/__init__.py
> Bio/Std.py
> Bio/config/DBRegistry.py
> Bio/sequtils.py
> Martel/Iterator.py
> Martel/Parser.py
> Martel/convert_re.py
> Scripts/Performance/biocorba_sql_server.py
> Tests/test_KeyWList.py
> Tests/unittest.py
> Tests/unittestgui.py
>
>
> If have created a patch which will fix these 19 files.
> As I don't have any wright premissions to the cvs repository, I will
> send
> the patch to Jeffrey Chang. He will eventually apply
> the patch to the cvs (if this meets approval of the
> other developers).
>
> Everybody who is owning one of the affected files
> should give a note to Jeffrey if he/she does not like
> that his code is patched.
>
>
> With best regards,
> --
>
>
> Peter
> -------------------------------------------------------------------
> Peter Slickers piet at clondiag.com
> Clondiag Chip Technologies http://www.clondiag.com/
> Löbstedter Str. 105
> 07749 Jena
> Germany
>
> Fon: 03641/5947-65 Fax: 03641/5947-20
> -------------------------------------------------------------------
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev
More information about the Biopython-dev
mailing list