Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change repr to describe() #1390

Merged
merged 3 commits into from
Feb 28, 2024
Merged

Change repr to describe() #1390

merged 3 commits into from
Feb 28, 2024

Conversation

mnwhite
Copy link
Contributor

@mnwhite mnwhite commented Feb 28, 2024

When the "parameters code" was added, it specified new behavior for __repr__(), listing all of the parameters whenever the object was returned to stdout. This is ok sometimes, but generates a massive amount of printed output in lifecycle models. Often the user just wants to do a quick check that an object is the class they think it is, or that there are the right number and kind of things in a list, and this behavior makes that impossible.

This commit only changes the function name __repr__ to describe. I.e. the "list everything" behavior is still there, it just needs to be explicitly requested rather than assumed as the default.

When the "parameters code" was added, it specified new behavior for `__repr__()`, listing *all* of the parameters whenever the object was returned to stdout. This is ok sometimes, but generates a massive amount of printed output in lifecycle models. Often the user just wants to do a quick check that an object is the class they think it is, or that there are the right number and kind of things in a list, and this behavior makes that impossible.

This commit *only* changes the function name `__repr__` to describe. I.e. the "list everything" behavior is still there, it just needs to be explicitly requested rather than assumed as the default.
Fixed tiny formatting errorS, and missing entry for prior pr.
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.69%. Comparing base (6a73c4f) to head (366578f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1390   +/-   ##
=======================================
  Coverage   71.69%   71.69%           
=======================================
  Files          84       84           
  Lines       13939    13939           
=======================================
  Hits         9993     9993           
  Misses       3946     3946           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mnwhite
Copy link
Contributor Author

mnwhite commented Feb 28, 2024

@alanlujan91 This is a small change to the "parameters code" you put in, as a simple aesthetic adjustment.

Copy link
Member

@alanlujan91 alanlujan91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks good!

@mnwhite mnwhite merged commit c3d6225 into master Feb 28, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants