I have a function in a file which I am calling in a separate script (as shown below). Printing directly from the function works correctly, however when I try to return the value to the script it sends 'None'.
Any help would be appreciated. Thanks
script:
import modules.functions as f
restype = 'THR'
atomtype = 'CA'
print f.AtomType(restype,atomtype)
function: (this is the part of the function which returns the value)
def AtomType(resName,atomType):
def threonine():
print 'well im here'
atoms = {'N' : 1,
'CA': 6,
'C' : 8,
'O' : 2,
'CB': 6,
'OG1': 1,
'CG2': 4,
}
print atoms[atomType]
return atoms[atomType]
residues = {'ALA' : hydrophobic,
'ARG' : arginine,
'ASN' : asparagine,
'ASP' : aspartate,
'CYS' : cysteine,
'GLN' : glutamine,
'GLU' : glutamate,
'GLY' : hydrophobic,
'HIS' : histidine,
'ILE' : hydrophobic,
'LEU' : hydrophobic,
'LYS' : lysine,
'MET' : methionine,
'PHE' : phenylalanine,
'PRO' : proline,
'SER' : serine,
'THR' : threonine,
'TRP' : tryptophan,
'TYR' : tyrosine,
'VAL' : hydrophobic,
}
residues[resName]()
and the outpu开发者_Go百科t I get is:
well im here
6
None
edit: added entire function
Here's a guess: AtomType
calls threonine
, but doesn't return its return value.
精彩评论