From ac76a43f80fa313dd8137b5e7760100af8148c09 Mon Sep 17 00:00:00 2001
From: Clemens Barth <barth@root-1.de>
Date: Fri, 2 Dec 2011 20:20:43 +0000
Subject: [PATCH] Dear all.

Some large data classes (elements, atoms and sticks) use

           __slots__

now.


Cheers,

Blendphys.
---
 io_mesh_pdb/import_pdb.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py
index ecf502045..8a860cbbc 100644
--- a/io_mesh_pdb/import_pdb.py
+++ b/io_mesh_pdb/import_pdb.py
@@ -184,8 +184,9 @@ ATOM_PDB_ELEMENTS_DEFAULT = (
 ATOM_PDB_ELEMENTS = []
 
 # This is the class, which stores the properties for one element.
-class CLASS_atom_pdb_Elements:  # TODO, use __slots__
-    def __init__(self, number, name,short_name, color, radii, radii_ionic):
+class CLASS_atom_pdb_Elements(object):
+    __slots__ = ('number', 'name', 'short_name', 'color', 'radii', 'radii_ionic')
+    def __init__(self, number, name, short_name, color, radii, radii_ionic):
         self.number = number
         self.name = name
         self.short_name = short_name
@@ -194,7 +195,8 @@ class CLASS_atom_pdb_Elements:  # TODO, use __slots__
         self.radii_ionic = radii_ionic
 
 # This is the class, which stores the properties of one atom.
-class CLASS_atom_pdb_atom:  # TODO, use __slots__
+class CLASS_atom_pdb_atom(object):  
+    __slots__ = ('element', 'name', 'location', 'radius', 'color', 'material')
     def __init__(self, element, name, location, radius, color, material):
         self.element = element
         self.name = name
@@ -204,7 +206,8 @@ class CLASS_atom_pdb_atom:  # TODO, use __slots__
         self.material = material
 
 # This is the class, which stores the two atoms of one stick.
-class CLASS_atom_pdb_stick:  # TODO, use __slots__
+class CLASS_atom_pdb_stick(object):
+    __slots__ = ('atom1', 'atom2')
     def __init__(self, atom1, atom2):
         self.atom1 = atom1
         self.atom2 = atom2
-- 
GitLab