Attributes in privates methods

Yasser Almeida Hernández pedro.al at fenhi.uh.cu
Fri Feb 19 16:08:06 CET 2010


Hi all.

I have a class with the attribute 'log_file', opened out of the class:
class ProteinCluster:
    def __init__(self,cluster_name,log_file):
       ...
       self.log_file = log_file
       ...
Then i have a private method which write in the log_file:
    def _read_structure(self, pdb_code):
       ...
       ...
       self.log_file.write('blablabla')
       ...
       ...
When i run the script, it raises the error:
AttributeError: ProteinCluster instance has no attribute 'log_file'

My question is, the class attributes are valids in private methods,  
like in publics methods?

Thanks


-- 
Yasser Almeida Hernández, BSc
Center of Molecular Inmunology (CIM)
Nanobiology Group
P.O.Box 16040, Havana, Cuba
Phone: (537) 214-3178
almeida at cim.sld.cu

----------------------------------------------------------------
Correo FENHI






More information about the Python-list mailing list