You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Removing tostring() needlessly breaks backwards compatibility, deprecation shouldn't lead to removal! #1952
Note that Biopython 1.44 and earlier would give a truncated version of repr(my_seq) for str(my_seq). If you are writing code which need to be backwards compatible with old Biopython, you should continue to use my_seq.tostring() rather than str(my_seq).
After 2f03509, we are left with NO WAY of converting a sequence to a string that works correctly for both Biopython 1.44 and Biopython 1.73. Plus, the comment that explains this is still there, i.e. now pointing users towards functionality that no longer exists.
I have to say I'm very concerned about the general attitude towards compatibility of the Biopython project if commits like 2f03509 are applied WITHOUT need and WITHOUT even making sure that comments like the one I quoted are fixed. For users like me, libraries like biopython are a small part of a large software universe we use, and there is neither time nor desire to track the development of each of those. If I cannot trust that using a library like Biopython won't constantly break existing code without a good reason, than in the end depending on this library is more a burden than a benefit.
In the case of str(seq_obj) (aka the __str__ method) and seq_obj.tostring() we deliberately moved much slower with this change because we knew it could affect more people than usual, but changing __str__ was important to fix an unfortunate early design change which blocked making Seq objects more like the Python string.
Biopython 1.44 was released back on 28 October 2007.
Biopython 1.45 made str(seq_object) behave sensibly, and that was released in 22 March 2008, so we've had over ten years with that as the recommended usage.
Since Biopython 1.64 (released 29 May 2014) using .tostring() would give a warning. That was over 4 and a half years with the warning in place.
If you really need a compatible way to do this:
fromBio.SeqimportSeqseq_obj=Seq("ACGT")
try:
# The old way, removed in Biopython 1.73as_string=seq_obj.tostring()
exceptAttributeError:
# The new way, needs Biopython 1.45 or later.# Don't use this on Biopython 1.44 or older as that truncates thisas_string=str(seq_obj)
Would you like that added to the DEPRECATED file?
In our shoes would you have kept the .tostring() method in place indefinitely?
I the light of Biopython 1.44 having been released 2007, I agree that this isn't necessary.
In our shoes would you have kept the .tostring() method in place indefinitely?
I would have kept it around until such time as there is some tangible benefit to removing it. Which for such a trivial function may very well mean indefinitely -- or it might not, depending on the further fate of the Seq class. But I fail to see the point in removing code just because it was deprecated for a long time.
Anyway, thank you for submitting a documentation fix!
@fgp If we don't remove deprecated code at some point, then Biopython will become an unmanageable mess. Biopython already is very conservative in its deprecation policy.
Activity
peterjc commentedon Mar 7, 2019
See pull request #1855
Our standard deprecation policy is here:
https://biopython.org/wiki/Deprecation_policy
In the case of
str(seq_obj)(aka the__str__method) andseq_obj.tostring()we deliberately moved much slower with this change because we knew it could affect more people than usual, but changing__str__was important to fix an unfortunate early design change which blocked makingSeqobjects more like the Python string.Biopython 1.44 was released back on 28 October 2007.
Biopython 1.45 made
str(seq_object)behave sensibly, and that was released in 22 March 2008, so we've had over ten years with that as the recommended usage.Since Biopython 1.64 (released 29 May 2014) using
.tostring()would give a warning. That was over 4 and a half years with the warning in place.If you really need a compatible way to do this:
Would you like that added to the DEPRECATED file?
In our shoes would you have kept the
.tostring()method in place indefinitely?CC @mdehoon
Documentation fix for biopython#1952
fgp commentedon Mar 7, 2019
I the light of Biopython 1.44 having been released 2007, I agree that this isn't necessary.
I would have kept it around until such time as there is some tangible benefit to removing it. Which for such a trivial function may very well mean indefinitely -- or it might not, depending on the further fate of the Seq class. But I fail to see the point in removing code just because it was deprecated for a long time.
Anyway, thank you for submitting a documentation fix!
mdehoon commentedon Mar 8, 2019
@fgp If we don't remove deprecated code at some point, then Biopython will become an unmanageable mess. Biopython already is very conservative in its deprecation policy.
Documentation fix for #1952
peterjc commentedon Dec 25, 2019
Belatedly closing this issue with the documentation improvement done in March.