Skip to content

Write __repr__/__str__ for format classes that uses reprlib so a user can print to get something readable #281

@NickleDave

Description

@NickleDave

Right now if we just do something like

>>> import crowsetta
>>> birdsongrec = crowsetta.example('Annotation.xml')
>>> birdsongrec

the auto-generated __repr__ provided by attrs will dump out every annotation to stdout. This is technically correct but not very helpful

Might be good to

  • override the __repr__ for each class and use reprlib in it to get an abbreviated representation of attributes
  • possibly provide an even friendlier version with __str__? In some cases I think it might be good to have an almost human-readable summary of the annotations in the file, "TextGrid with 5 tiers" or something like that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions