-
Notifications
You must be signed in to change notification settings - Fork 823
Closed
Description
In PR #1222 we fix the reprto match old behaviour, but this makes Residue/SegmentGroup representation a little long as it will always print the repr of each member:
u = mda.Universe(PSF, DCD)
rg = u.residues[:10]
<ResidueGroup [<Residue MET, 1>, <Residue ARG, 2>, <Residue ILE, 3>, <Residue ILE, 4>, <Residue LEU, 5>, <Residue LEU, 6>, <Residue GLY, 7>, <Residue ALA, 8>, <Residue PRO, 9>, <Residue GLY, 10>]>TODO:
- Implement both
__str__and__repr__forAtomGroup,ResidueGroup, andSegmentGroup. Ideally this is done in a generic way inGroupBase __repr__is to be short and terse (similar to how AtomGroup is now) ie'<ResidueGroup with 5 Residues>'__str__is to be long, pretty and informational, similar to howResidueGroupis currently, soAtomGroupneeds a similar treatment.- the
strrepresentation needs to truncate itself if the Group is over 10 members, and instead only show the first and last three members in a verbose way. This is similar to how long numpy arrays truncate the repr of themselves:
np.arange(10000)
array([ 0, 1, 2, ..., 9997, 9998, 9999])Reactions are currently unavailable