In https://github.com/biopython/biopython/blob/518c4be6ae16f1e00bfd55781171da91282b340a/Bio/SeqUtils/ProtParam.py I have this importing statement:
from Bio.SeqUtils import molecular_weight
and then in a Class:
class ProteinAnalysis:
.....
.....
def molecular_weight(self):
"""Calculate MW from Protein sequence."""
return molecular_weight(
self.sequence, seq_type="protein", monoisotopic=self.monoisotopic
)
......
......
What is this type of coding called? Is it normal to call imported function and class method with same name?
To my knowledge, self.molecular_weights is not equal to molecular_weights, but why call them the same? Is that PEP 8 compliant?
Would
a = ProteinAnalysis()
print(a.molecular_weights == molecular_weights)
give True or False?
What about:
print(a.molecular_weights(*args,**kwargs) == molecular_weights(*args, **kwargs))