Permalink
Browse files

Issue a DeprecatingWarning when accessing the .data property of Seq o…

…bjects
  • Loading branch information...
1 parent f70cc43 commit e5fbcd75ff9d2415c82ba5278d698302eed881ee Michiel de Hoon committed Aug 28, 2010
Showing with 6 additions and 3 deletions.
  1. +3 −1 Bio/Seq.py
  2. +3 −2 DEPRECATED
View
@@ -105,7 +105,7 @@ def __init__(self, data, alphabet = Alphabet.generic_alphabet):
# Note this is read only since the Seq object is meant to be imutable
@property
def data(self) :
- """Sequence as a string (OBSOLETE/DEPRECATED).
+ """Sequence as a string (DEPRECATED).
This is a read only property provided for backwards compatility with
older versions of Biopython (as is the tostring() method). We now
@@ -127,6 +127,8 @@ def data(self) :
...
AttributeError: can't set attribute
"""
+ import warnings
+ warnings.warn("Accessing the .data attribute is deprecated. Please use str(my_seq) or my_seq_tostring() instead of my_seq.data.", DeprecationWarning)
return str(self)
def __repr__(self):
View
@@ -129,8 +129,9 @@ Please move to NumPy for Biopython 1.49 or later.
Bio.Seq and the data property
=============================
Direct use of the Seq object (and MutableSeq object) .data property is
-discouraged. As of Release 1.49, writing to the Seq object's .data property
-triggered a warning, and this property was made read only in Release 1.53.
+deprecated. As of Release 1.49, writing to the Seq object's .data property
+triggered a warning, and this property was made read only in Release 1.53. In
+Release 1.55 final, accessing the .data property gives a DeprecationWarning.
Bio.Transcribe and Bio.Translate
================================

0 comments on commit e5fbcd7

Please sign in to comment.