I2PC / scipion

Scipion is an image processing framework to obtain 3D models of macromolecular complexes using Electron Microscopy (3DEM)
http://scipion.i2pc.es
Other
76 stars 47 forks source link

Fixed import from pdb #2028

Closed mmmtnez closed 5 years ago

mmmtnez commented 5 years ago

PDBList init has the default value pdb=os.getcwd() unfortunately initializing parameters with something that is mutable is bad practice. The reason for this is that the def statement only gets executed once, which is when the function is defined. Thus the initializer value only gets created once. For a reference type (as opposed to an immutable type which cannot change) like a function or a dictionary, this ends up as a visible and surprising pitfall, whereas for value types, it goes unnoticed.

In summary, we modify the call to PDBlist so it passes explicitly the value of the pdb argument.

Note, I do not modify PDBList.__init_definition because is a biopython function, that is, belongs to an external module.