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

Adopt from_* naming convention for classmethods #24

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

paulromano
Copy link
Collaborator

Based on #23, please review/merge that first


Many Python packages use a convention whereby a @classmethod called from_* is an "alternate constructor" that returns a new instance of the class. To note a few examples:

This PR adopts this convention for the Geometry and Mesh classes.

Copy link
Collaborator

@akoen akoen left a comment

Choose a reason for hiding this comment

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

Agree with the name changes. We should, however, add deprecated aliases for the old method names to avoid breaking functionality for existing users.

@paulromano
Copy link
Collaborator Author

@akoen I've added back the older names as deprecated aliases (users will get a FutureWarning with them). Any further requests on this PR?

@paulromano paulromano requested a review from akoen January 4, 2024 12:53
@paulromano paulromano merged commit 2907181 into Thea-Energy:main Jan 5, 2024
2 checks passed
@paulromano paulromano deleted the classmethod-naming branch January 5, 2024 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants