[Biopython-dev] Nexus __slots__ and Python 3.3

Peter Cock p.j.a.cock at googlemail.com
Sat Sep 29 20:25:14 UTC 2012

Hello all,

I've started testing under the newly released Python 3.3,
and there is a new problem which I don't recall running
into when I tried one of the Python 3.3 alpha releases:

$ python3 test_Nexus.py
Traceback (most recent call last):
  File "test_Nexus.py", line 7, in <module>
    from Bio.Nexus import Nexus, Trees
  File "/Users/peterjc/lib/python3.3/site-packages/Bio/Nexus/Nexus.py",
line 513, in <module>
    class Nexus(object):
ValueError: 'original_taxon_order' in __slots__ conflicts with class variable

I can fix this with the following change, which appears
to have no side effects under Python 2 (the unit tests
still all pass):

$ git diff
diff --git a/Bio/Nexus/Nexus.py b/Bio/Nexus/Nexus.py
index 1d6abd2..8c7fbcc 100644
--- a/Bio/Nexus/Nexus.py
+++ b/Bio/Nexus/Nexus.py
@@ -511,8 +511,6 @@ class Block(object):

 class Nexus(object):

-    __slots__=['original_taxon_order','__dict__']
     def __init__(self, input=None):
         self.ntax=0                     # number of taxa
         self.nchar=0                    # number of characters

I have committed this:

However, I'm not really sure what the intention of this
line was in the first place. It is (assuming I didn't miss
anything with grep), or now was, the only use of
__slots__ in the whole of Biopython.



More information about the Biopython-dev mailing list